tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
28
pulls
pipelines
append href to urls for inline links in toolbar
awarm.space
1 year ago
5abe2819
68214263
+7
-10
1 changed file
expand all
collapse all
unified
split
components
Toolbar
InlineLinkToolbar.tsx
+7
-10
components/Toolbar/InlineLinkToolbar.tsx
···
107
let editor = focusedEditor?.editor;
108
if (!editor || start === null || !end || !focusedBlock) return;
109
let tr = editor.tr;
110
-
tr.addMark(
111
-
start,
112
-
end,
113
-
schema.marks.link.create({ href: linkValue }),
114
-
);
115
tr.setSelection(TextSelection.create(tr.doc, tr.selection.to));
116
setEditorState(focusedBlock?.entityID, {
117
editor: editor.apply(tr),
···
143
let editor = focusedEditor?.editor;
144
if (!editor || !start || !end || !focusedBlock) return;
145
let tr = editor.tr;
146
-
tr.addMark(
147
-
start,
148
-
end,
149
-
schema.marks.link.create({ href: linkValue }),
150
-
);
151
setEditorState(focusedBlock?.entityID, {
152
editor: editor.apply(tr),
153
});
···
107
let editor = focusedEditor?.editor;
108
if (!editor || start === null || !end || !focusedBlock) return;
109
let tr = editor.tr;
110
+
let href = linkValue;
111
+
if (!href.startsWith("http")) href = `https://${href}`;
112
+
tr.addMark(start, end, schema.marks.link.create({ href }));
0
0
113
tr.setSelection(TextSelection.create(tr.doc, tr.selection.to));
114
setEditorState(focusedBlock?.entityID, {
115
editor: editor.apply(tr),
···
141
let editor = focusedEditor?.editor;
142
if (!editor || !start || !end || !focusedBlock) return;
143
let tr = editor.tr;
144
+
145
+
let href = linkValue;
146
+
if (!href.startsWith("http")) href = `https://${href}`;
147
+
tr.addMark(start, end, schema.marks.link.create({ href }));
0
148
setEditorState(focusedBlock?.entityID, {
149
editor: editor.apply(tr),
150
});