@lexical/dragon 0.14.5 → 0.16.0

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.
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict';
8
10
 
9
11
  var lexical = require('lexical');
@@ -15,6 +17,7 @@ var lexical = require('lexical');
15
17
  * LICENSE file in the root directory of this source tree.
16
18
  *
17
19
  */
20
+
18
21
  function registerDragonSupport(editor) {
19
22
  const origin = window.location.origin;
20
23
  const handler = event => {
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import { $getSelection, $isRangeSelection, $isTextNode } from 'lexical';
8
10
 
9
11
  /**
@@ -13,6 +15,7 @@ import { $getSelection, $isRangeSelection, $isTextNode } from 'lexical';
13
15
  * LICENSE file in the root directory of this source tree.
14
16
  *
15
17
  */
18
+
16
19
  function registerDragonSupport(editor) {
17
20
  const origin = window.location.origin;
18
21
  const handler = event => {
package/LexicalDragon.js CHANGED
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict'
8
10
  const LexicalDragon = process.env.NODE_ENV === 'development' ? require('./LexicalDragon.dev.js') : require('./LexicalDragon.prod.js');
9
11
  module.exports = LexicalDragon;
package/LexicalDragon.mjs CHANGED
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import * as modDev from './LexicalDragon.dev.mjs';
8
10
  import * as modProd from './LexicalDragon.prod.mjs';
9
11
  const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
@@ -3,6 +3,8 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalDragon.dev.mjs') : import('./LexicalDragon.prod.mjs'));
8
10
  export const registerDragonSupport = mod.registerDragonSupport;
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  'use strict';var g=require("lexical");
8
10
  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
11
  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)}}
@@ -3,5 +3,7 @@
3
3
  *
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
+ *
6
7
  */
8
+
7
9
  import{$getSelection as e,$isRangeSelection as t,$isTextNode as n}from"lexical";function o(o){const i=window.location.origin,a=a=>{if(a.origin!==i)return;const r=o.getRootElement();if(document.activeElement!==r)return;const s=a.data;if("string"==typeof s){let i;try{i=JSON.parse(s)}catch(e){return}if(i&&"nuanria_messaging"===i.protocol&&"request"===i.type){const r=i.payload;if(r&&"makeChanges"===r.functionId){const i=r.args;if(i){const[r,s,c,g,d,f]=i;o.update((()=>{const o=e();if(t(o)){const e=o.anchor;let t=e.getNode(),i=0,f=0;if(n(t)&&r>=0&&s>=0&&(i=r,f=r+s,o.setTextNodeRange(t,i,t,f)),i===f&&""===c||(o.insertRawText(c),t=e.getNode()),n(t)){i=g,f=g+d;const e=t.getTextContentSize();i=i>e?e:i,f=f>e?e:f,o.setTextNodeRange(t,i,t,f)}a.stopImmediatePropagation()}}))}}}}};return window.addEventListener("message",a,!0),()=>{window.removeEventListener("message",a,!0)}}export{o as registerDragonSupport};
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "accessibility"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.14.5",
12
+ "version": "0.16.0",
13
13
  "main": "LexicalDragon.js",
14
14
  "types": "index.d.ts",
15
15
  "repository": {
@@ -37,6 +37,6 @@
37
37
  }
38
38
  },
39
39
  "dependencies": {
40
- "lexical": "0.14.5"
40
+ "lexical": "0.16.0"
41
41
  }
42
42
  }