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
107
let editor = focusedEditor?.editor;
108
108
if (!editor || start === null || !end || !focusedBlock) return;
109
109
let tr = editor.tr;
110
110
-
tr.addMark(
111
111
-
start,
112
112
-
end,
113
113
-
schema.marks.link.create({ href: linkValue }),
114
114
-
);
110
110
+
let href = linkValue;
111
111
+
if (!href.startsWith("http")) href = `https://${href}`;
112
112
+
tr.addMark(start, end, schema.marks.link.create({ href }));
115
113
tr.setSelection(TextSelection.create(tr.doc, tr.selection.to));
116
114
setEditorState(focusedBlock?.entityID, {
117
115
editor: editor.apply(tr),
···
143
141
let editor = focusedEditor?.editor;
144
142
if (!editor || !start || !end || !focusedBlock) return;
145
143
let tr = editor.tr;
146
146
-
tr.addMark(
147
147
-
start,
148
148
-
end,
149
149
-
schema.marks.link.create({ href: linkValue }),
150
150
-
);
144
144
+
145
145
+
let href = linkValue;
146
146
+
if (!href.startsWith("http")) href = `https://${href}`;
147
147
+
tr.addMark(start, end, schema.marks.link.create({ href }));
151
148
setEditorState(focusedBlock?.entityID, {
152
149
editor: editor.apply(tr),
153
150
});