@lexical/dragon
Advanced tools
Comparing version 0.6.1-next.0 to 0.6.2
@@ -13,3 +13,9 @@ /** | ||
function registerDragonSupport(editor) { | ||
const origin = window.location.origin; | ||
const handler = event => { | ||
if (event.origin !== origin) { | ||
return; | ||
} | ||
const rootElement = editor.getRootElement(); | ||
@@ -16,0 +22,0 @@ |
@@ -8,3 +8,3 @@ /** | ||
'use strict';var g=require("lexical"); | ||
exports.registerDragonSupport=function(l){let r=m=>{var h=l.getRootElement();if(document.activeElement===h&&(h=m.data,"string"===typeof h)){try{var a=JSON.parse(h)}catch(k){return}if(a&&"nuanria_messaging"===a.protocol&&"request"===a.type&&(a=a.payload)&&"makeChanges"===a.functionId&&(a=a.args)){const [k,n,p,q,t]=a;l.update(()=>{const f=g.$getSelection();if(g.$isRangeSelection(f)){var e=f.anchor;let b=e.getNode(),c=0,d=0;g.$isTextNode(b)&&0<=k&&0<=n&&(c=k,d=k+n,f.setTextNodeRange(b,c,b,d));if(c!== | ||
d||""!==p)f.insertRawText(p),b=e.getNode();g.$isTextNode(b)&&(c=q,d=q+t,e=b.getTextContentSize(),c=c>e?e:c,d=d>e?e:d,f.setTextNodeRange(b,c,b,d));m.stopImmediatePropagation()}})}}};window.addEventListener("message",r,!0);return()=>{window.removeEventListener("message",r,!0)}} | ||
exports.registerDragonSupport=function(m){let t=window.location.origin,r=l=>{if(l.origin===t){var h=m.getRootElement();if(document.activeElement===h&&(h=l.data,"string"===typeof h)){try{var a=JSON.parse(h)}catch(k){return}if(a&&"nuanria_messaging"===a.protocol&&"request"===a.type&&(a=a.payload)&&"makeChanges"===a.functionId&&(a=a.args)){const [k,n,p,q,u]=a;m.update(()=>{const f=g.$getSelection();if(g.$isRangeSelection(f)){var e=f.anchor;let b=e.getNode(),c=0,d=0;g.$isTextNode(b)&&0<=k&&0<=n&&(c=k, | ||
d=k+n,f.setTextNodeRange(b,c,b,d));if(c!==d||""!==p)f.insertRawText(p),b=e.getNode();g.$isTextNode(b)&&(c=q,d=q+u,e=b.getTextContentSize(),c=c>e?e:c,d=d>e?e:d,f.setTextNodeRange(b,c,b,d));l.stopImmediatePropagation()}})}}}};window.addEventListener("message",r,!0);return()=>{window.removeEventListener("message",r,!0)}} |
@@ -12,6 +12,6 @@ { | ||
"license": "MIT", | ||
"version": "0.6.1-next.0", | ||
"version": "0.6.2", | ||
"main": "LexicalDragon.js", | ||
"peerDependencies": { | ||
"lexical": "0.6.1-next.0" | ||
"lexical": "0.6.2" | ||
}, | ||
@@ -18,0 +18,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
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
7069
105