@lexical/mark
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -43,3 +43,4 @@ /** | ||
ids: this.getIDs(), | ||
type: 'mark' | ||
type: 'mark', | ||
version: 1 | ||
}; | ||
@@ -46,0 +47,0 @@ } |
@@ -8,8 +8,8 @@ /** | ||
'use strict';var k=require("lexical"),m=require("@lexical/utils"); | ||
class n extends k.ElementNode{static getType(){return"mark"}static clone(a){return new n(Array.from(a.__ids),a.__key)}static importDOM(){return null}static importJSON(a){let b=p(a.ids);b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),ids:this.getIDs(),type:"mark"}}constructor(a,b){super(b);this.__ids=a||[]}createDOM(a){let b=document.createElement("mark");m.addClassNamesToElement(b,a.theme.mark);1<this.__ids.length&&m.addClassNamesToElement(b, | ||
a.theme.markOverlap);return b}updateDOM(a,b,c){a=a.__ids.length;let e=this.__ids.length;c=c.theme.markOverlap;a!==e&&(1===a?2===e&&m.addClassNamesToElement(b,c):1===e&&m.removeClassNamesFromElement(b,c));return!1}hasID(a){let b=this.getIDs();for(let c=0;c<b.length;c++)if(a===b[c])return!0;return!1}getIDs(){let a=this.getLatest();return q(a)?a.__ids:[]}addID(a){var b=this.getWritable();if(q(b)){let c=b.__ids;b.__ids=c;for(b=0;b<c.length;b++)if(a===c[b])return;c.push(a)}}deleteID(a){var b=this.getWritable(); | ||
if(q(b)){let c=b.__ids;b.__ids=c;for(b=0;b<c.length;b++)if(a===c[b]){c.splice(b,1);break}}}insertNewAfter(a){a=this.getParentOrThrow().insertNewAfter(a);if(k.$isElementNode(a)){let b=p(this.__ids);a.append(b);return b}return null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(a,b,c){if(!k.$isRangeSelection(b)||"html"===c)return!1;let e=b.anchor,d=b.focus;a=e.getNode();c=d.getNode();b=b.isBackward()?e.offset-d.offset:d.offset- | ||
e.offset;return this.isParentOf(a)&&this.isParentOf(c)&&this.getTextContent().length===b}excludeFromCopy(a){return"clone"!==a}}function p(a){return new n(a)}function q(a){return a instanceof n}exports.$createMarkNode=p;exports.$getMarkIDs=function(a,b){for(;null!==a;){if(q(a))return a.getIDs();if(k.$isTextNode(a)&&b===a.getTextContentSize()){let c=a.getNextSibling();if(q(c))return c.getIDs()}a=a.getParent()}return null};exports.$isMarkNode=q; | ||
class n extends k.ElementNode{static getType(){return"mark"}static clone(a){return new n(Array.from(a.__ids),a.__key)}static importDOM(){return null}static importJSON(a){let b=p(a.ids);b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportJSON(){return{...super.exportJSON(),ids:this.getIDs(),type:"mark",version:1}}constructor(a,b){super(b);this.__ids=a||[]}createDOM(a){let b=document.createElement("mark");m.addClassNamesToElement(b,a.theme.mark);1<this.__ids.length&& | ||
m.addClassNamesToElement(b,a.theme.markOverlap);return b}updateDOM(a,b,c){a=a.__ids.length;let e=this.__ids.length;c=c.theme.markOverlap;a!==e&&(1===a?2===e&&m.addClassNamesToElement(b,c):1===e&&m.removeClassNamesFromElement(b,c));return!1}hasID(a){let b=this.getIDs();for(let c=0;c<b.length;c++)if(a===b[c])return!0;return!1}getIDs(){let a=this.getLatest();return q(a)?a.__ids:[]}addID(a){var b=this.getWritable();if(q(b)){let c=b.__ids;b.__ids=c;for(b=0;b<c.length;b++)if(a===c[b])return;c.push(a)}}deleteID(a){var b= | ||
this.getWritable();if(q(b)){let c=b.__ids;b.__ids=c;for(b=0;b<c.length;b++)if(a===c[b]){c.splice(b,1);break}}}insertNewAfter(a){a=this.getParentOrThrow().insertNewAfter(a);if(k.$isElementNode(a)){let b=p(this.__ids);a.append(b);return b}return null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(a,b,c){if(!k.$isRangeSelection(b)||"html"===c)return!1;let e=b.anchor,d=b.focus;a=e.getNode();c=d.getNode();b=b.isBackward()?e.offset- | ||
d.offset:d.offset-e.offset;return this.isParentOf(a)&&this.isParentOf(c)&&this.getTextContent().length===b}excludeFromCopy(a){return"clone"!==a}}function p(a){return new n(a)}function q(a){return a instanceof n}exports.$createMarkNode=p;exports.$getMarkIDs=function(a,b){for(;null!==a;){if(q(a))return a.getIDs();if(k.$isTextNode(a)&&b===a.getTextContentSize()){let c=a.getNextSibling();if(q(c))return c.getIDs()}a=a.getParent()}return null};exports.$isMarkNode=q; | ||
exports.$unwrapMarkNode=function(a){let b=a.getChildren(),c=null;for(let e=0;e<b.length;e++){let d=b[e];null===c?a.insertBefore(d):c.insertAfter(d);c=d}a.remove()}; | ||
exports.$wrapSelectionInMarkNode=function(a,b,c){let e=a.getNodes();var d=a.anchor.offset,g=a.focus.offset;a=e.length;let x=b?g:d;b=b?d:g;let r,h;for(d=0;d<a;d++){let l=e[d];if(k.$isElementNode(h)&&h.isParentOf(l))continue;g=0===d;let u=d===a-1;var f=void 0;if(k.$isTextNode(l)){let v=l.getTextContentSize(),w=g?x:0,t=u?b:v;if(0===w&&0===t)continue;f=l.splitText(w,t);f=1<f.length&&(3===f.length||g&&!u||t===v)?f[1]:f[0]}else k.$isElementNode(l)&&l.isInline()&&(f=l);void 0!==f?f&&f.is(r)||(g=f.getParent(), | ||
null!=g&&g.is(r)||(h=void 0),r=g,void 0===h&&(h=p([c]),f.insertBefore(h)),h.append(f)):h=r=void 0}};exports.MarkNode=n |
@@ -11,9 +11,9 @@ { | ||
"license": "MIT", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"main": "LexicalMark.js", | ||
"peerDependencies": { | ||
"lexical": "0.3.3" | ||
"lexical": "0.3.4" | ||
}, | ||
"dependencies": { | ||
"@lexical/utils": "0.3.3" | ||
"@lexical/utils": "0.3.4" | ||
}, | ||
@@ -20,0 +20,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16096
9
322
1
+ Added@lexical/list@0.3.4(transitive)
+ Added@lexical/table@0.3.4(transitive)
+ Added@lexical/utils@0.3.4(transitive)
+ Addedlexical@0.3.4(transitive)
- Removed@lexical/list@0.3.3(transitive)
- Removed@lexical/table@0.3.3(transitive)
- Removed@lexical/utils@0.3.3(transitive)
- Removedlexical@0.3.3(transitive)
Updated@lexical/utils@0.3.4