markupeditor 0.9.45 → 0.9.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/markup-editor.js +13 -6
- package/package.json +1 -1
package/dist/markup-editor.js
CHANGED
|
@@ -15225,9 +15225,9 @@ let baseNodes = OrderedMap.from({
|
|
|
15225
15225
|
//
|
|
15226
15226
|
// 1. Changes to div here may need to be reflected in DivView found in markup.js.
|
|
15227
15227
|
//
|
|
15228
|
-
// 2. We use a
|
|
15229
|
-
// are used in the Swift MarkupEditor under these specific conditions, and
|
|
15230
|
-
// attributes prevents issues when pasting (e.g., from GitHub READMEs) include divs.
|
|
15228
|
+
// 2. We use a tag rule with attribute selectors to require divs to include id, class, parentId.
|
|
15229
|
+
// The div elements are used in the Swift MarkupEditor under these specific conditions, and
|
|
15230
|
+
// requiring these attributes prevents issues when pasting (e.g., from GitHub READMEs) include divs.
|
|
15231
15231
|
//
|
|
15232
15232
|
// 3. It might be possible to exclude divs that don't conform to MarkupEditor expectations
|
|
15233
15233
|
// by using a rule. For now, deriving a Node from html always removes divs and buttons, so
|
|
@@ -15251,7 +15251,7 @@ let baseNodes = OrderedMap.from({
|
|
|
15251
15251
|
writingsuggestions: {default: false},
|
|
15252
15252
|
},
|
|
15253
15253
|
parseDOM: [{
|
|
15254
|
-
|
|
15254
|
+
tag: "div[id][class][parentId]",
|
|
15255
15255
|
getAttrs(dom) {
|
|
15256
15256
|
const id = dom.getAttribute("id");
|
|
15257
15257
|
const parentId = dom.getAttribute("parentId");
|
|
@@ -35409,7 +35409,7 @@ function _getMarkTypes() {
|
|
|
35409
35409
|
}
|
|
35410
35410
|
/**
|
|
35411
35411
|
* Return the link attributes at the selection.
|
|
35412
|
-
*
|
|
35412
|
+
*
|
|
35413
35413
|
* @returns {object} An Object whose properties are the link attributes (like href, link) at the selection.
|
|
35414
35414
|
*/
|
|
35415
35415
|
function getLinkAttributes() {
|
|
@@ -42154,6 +42154,7 @@ class LinkView {
|
|
|
42154
42154
|
link.setAttribute('href', href);
|
|
42155
42155
|
link.setAttribute('title', title);
|
|
42156
42156
|
link.addEventListener('click', (ev)=> {
|
|
42157
|
+
ev.preventDefault();
|
|
42157
42158
|
if (ev.altKey) {
|
|
42158
42159
|
if (href.startsWith('#')) {
|
|
42159
42160
|
let id = href.substring(1);
|
|
@@ -43319,7 +43320,13 @@ class MarkupEditor {
|
|
|
43319
43320
|
'focus': () => { setTimeout(() => focused(target)); },
|
|
43320
43321
|
'blur': () => { setTimeout(() => blurred(target)); },
|
|
43321
43322
|
'cut': () => { setTimeout(() => { callbackInput(target); }, 0); },
|
|
43322
|
-
'click': (view
|
|
43323
|
+
'click': (view, event) => {
|
|
43324
|
+
const altKey = event.altKey;
|
|
43325
|
+
// Plain click on a link: LinkView's own listener already decided what
|
|
43326
|
+
// to do (open on Alt+Click, nothing otherwise); don't also report it,
|
|
43327
|
+
// or markupClicked's default behavior would follow the link regardless.
|
|
43328
|
+
setTimeout(() => { if (altKey || !getLinkAttributes().href) clicked(view, target); }, 0);
|
|
43329
|
+
},
|
|
43323
43330
|
'delete': () => { setTimeout(() => { callbackInput(target); }, 0); },
|
|
43324
43331
|
},
|
|
43325
43332
|
handlePaste(view, event) {
|