.
This commit is contained in:
+6
-6
@@ -676,14 +676,14 @@ impl Publisher {
|
||||
container(space()).width(BUTTON_WIDTH)
|
||||
};
|
||||
|
||||
let base = self.document.origin().as_str();
|
||||
let base = self.document.origin();
|
||||
|
||||
let subject = match &quad.subject {
|
||||
NamedOrBlankNode::NamedNode(subject) => subject.as_str(),
|
||||
_ => "",
|
||||
};
|
||||
|
||||
let subject_input_base = iri_input(&self.curie_helper, "Subject", Some(&base), subject);
|
||||
let subject_input_base = iri_input(&self.curie_helper, "Subject", Some(base), subject);
|
||||
let subject_input = if state.read_only {
|
||||
subject_input_base
|
||||
} else {
|
||||
@@ -693,7 +693,7 @@ impl Publisher {
|
||||
let predicate_input_base = iri_input(
|
||||
&self.curie_helper,
|
||||
"Predicate",
|
||||
Some(&base),
|
||||
Some(base),
|
||||
quad.predicate.as_str(),
|
||||
);
|
||||
let predicate_input = if state.read_only {
|
||||
@@ -743,7 +743,7 @@ impl Publisher {
|
||||
.into()
|
||||
}
|
||||
} else {
|
||||
let base = iri_input(&self.curie_helper, "Object", Some(&base), value.as_str())
|
||||
let base = iri_input(&self.curie_helper, "Object", Some(base), value.as_str())
|
||||
.on_shift_click(Message::NavigateToObject(key));
|
||||
if state.read_only {
|
||||
base.into()
|
||||
@@ -937,7 +937,7 @@ impl Publisher {
|
||||
let subject_column = table::column("Subject", |triple: TripleRef| {
|
||||
let curie = if let NamedOrBlankNodeRef::NamedNode(subject) = triple.subject {
|
||||
Some(self.curie_helper
|
||||
.abbreviate(Some(self.document.origin().as_str()), subject.as_str())
|
||||
.abbreviate(Some(self.document.origin()), subject.as_str())
|
||||
.unwrap_or_else(|| subject.as_str().to_string()))
|
||||
} else {
|
||||
None
|
||||
@@ -966,7 +966,7 @@ impl Publisher {
|
||||
match triple.object {
|
||||
TermRef::NamedNode(node) => {
|
||||
let curie = self.curie_helper
|
||||
.abbreviate(Some(self.document.origin().as_str()), node.as_str())
|
||||
.abbreviate(Some(self.document.origin()), node.as_str())
|
||||
.unwrap_or_else(|| node.as_str().to_string());
|
||||
|
||||
let label = self.resource_descriptions
|
||||
|
||||
@@ -7,6 +7,7 @@ use iced::clipboard::Content;
|
||||
use iced::mouse::{Cursor, Interaction};
|
||||
use iced::widget::text_input::{Catalog, Status, Style, StyleFn};
|
||||
use iced::{Element, Event, Length, Rectangle, Size, keyboard, widget};
|
||||
use url::Url;
|
||||
|
||||
pub struct State {
|
||||
control: bool,
|
||||
@@ -19,7 +20,7 @@ where
|
||||
Renderer: text::Renderer,
|
||||
{
|
||||
curie_helper: &'a CurieHelper,
|
||||
base: Option<String>,
|
||||
base: Option<&'a Url>,
|
||||
on_control_click: Option<Message>,
|
||||
on_shift_click: Option<Message>,
|
||||
text_input: widget::TextInput<'a, Message, Theme, Renderer>,
|
||||
@@ -34,7 +35,7 @@ where
|
||||
pub fn new(
|
||||
curie_helper: &'a CurieHelper,
|
||||
placeholder: &'a str,
|
||||
base: Option<&str>,
|
||||
base: Option<&'a Url>,
|
||||
iri: &str,
|
||||
) -> Self {
|
||||
let display_value = curie_helper
|
||||
@@ -43,7 +44,7 @@ where
|
||||
let text_input = widget::TextInput::new(placeholder, display_value);
|
||||
Self {
|
||||
curie_helper,
|
||||
base: base.map(String::from),
|
||||
base,
|
||||
on_control_click: None,
|
||||
on_shift_click: None,
|
||||
text_input,
|
||||
@@ -72,7 +73,7 @@ where
|
||||
pub fn on_input(mut self, on_input: impl Fn(String) -> Message + 'a) -> Self {
|
||||
let base_clone = self.base.clone();
|
||||
let wrapped = move |value: String| {
|
||||
let expanded_value = self.curie_helper.expand(base_clone.as_deref(), &value);
|
||||
let expanded_value = self.curie_helper.expand(base_clone, &value);
|
||||
on_input(expanded_value.unwrap_or_else(|| value))
|
||||
};
|
||||
|
||||
@@ -117,7 +118,7 @@ where
|
||||
pub fn iri_input<'a, Message, Theme, Renderer>(
|
||||
curie_helper: &'a CurieHelper,
|
||||
placeholder: &'a str,
|
||||
base: Option<&str>,
|
||||
base: Option<&'a Url>,
|
||||
iri: &str,
|
||||
) -> IriInput<'a, Message, Theme, Renderer>
|
||||
where
|
||||
@@ -246,7 +247,7 @@ where
|
||||
|
||||
let clipboard = shell.clipboard_mut();
|
||||
if let Some(Content::Text(content)) = &clipboard.write {
|
||||
if let Some(expanded) = self.curie_helper.expand(self.base.as_deref(), &content) {
|
||||
if let Some(expanded) = self.curie_helper.expand(self.base, &content) {
|
||||
clipboard.write = Some(Content::Text(expanded));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user