@lexical/dragon 0.6.1-next.0 → 0.6.2

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.
@@ -10,7 +10,13 @@ var lexical = require('lexical');
10
10
 
11
11
  /** @module @lexical/dragon */
12
12
  function registerDragonSupport(editor) {
13
+ const origin = window.location.origin;
14
+
13
15
  const handler = event => {
16
+ if (event.origin !== origin) {
17
+ return;
18
+ }
19
+
14
20
  const rootElement = editor.getRootElement();
15
21
 
16
22
  if (document.activeElement !== rootElement) {
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict';var g=require("lexical");
8
- 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!==
9
- 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)}}
8
+ 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,
9
+ 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)}}
package/package.json CHANGED
@@ -9,10 +9,10 @@
9
9
  "accessibility"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.6.1-next.0",
12
+ "version": "0.6.2",
13
13
  "main": "LexicalDragon.js",
14
14
  "peerDependencies": {
15
- "lexical": "0.6.1-next.0"
15
+ "lexical": "0.6.2"
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",