@lexical/file 0.14.0 → 0.14.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.
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { CLEAR_HISTORY_COMMAND } from 'lexical';
8
8
 
9
- var version = "0.14.0";
9
+ var version = "0.14.2";
10
10
 
11
11
  /**
12
12
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -8,7 +8,7 @@
8
8
 
9
9
  var lexical = require('lexical');
10
10
 
11
- var version = "0.14.0";
11
+ var version = "0.14.2";
12
12
 
13
13
  /**
14
14
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -4,4 +4,4 @@
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
- import{CLEAR_HISTORY_COMMAND as e}from"lexical";function t(t){!function(e){const t=document.createElement("input");t.type="file",t.accept=".lexical",t.addEventListener("change",(t=>{const n=t.target;if(n.files){const t=n.files[0],o=new FileReader;o.readAsText(t,"UTF-8"),o.onload=t=>{if(t.target){const n=t.target.result;e(n)}}}})),t.click()}((n=>{const o=JSON.parse(n),i=t.parseEditorState(JSON.stringify(o.editorState));t.setEditorState(i),t.dispatchCommand(e,void 0)}))}function n(e,t=Object.freeze({})){const n=new Date;!function(e,t){const n=document.createElement("a"),o=document.body;if(null===o)return;o.appendChild(n),n.style.display="none";const i=JSON.stringify(e),c=new Blob([i],{type:"octet/stream"}),a=window.URL.createObjectURL(c);n.href=a,n.download=t,n.click(),window.URL.revokeObjectURL(a),n.remove()}({editorState:e.getEditorState(),lastSaved:n.getTime(),source:t.source||"Lexical",version:"0.14.0"},`${t.fileName||n.toISOString()}.lexical`)}export{n as exportFile,t as importFile};
7
+ import{CLEAR_HISTORY_COMMAND as e}from"lexical";function t(t){!function(e){const t=document.createElement("input");t.type="file",t.accept=".lexical",t.addEventListener("change",(t=>{const n=t.target;if(n.files){const t=n.files[0],o=new FileReader;o.readAsText(t,"UTF-8"),o.onload=t=>{if(t.target){const n=t.target.result;e(n)}}}})),t.click()}((n=>{const o=JSON.parse(n),i=t.parseEditorState(JSON.stringify(o.editorState));t.setEditorState(i),t.dispatchCommand(e,void 0)}))}function n(e,t=Object.freeze({})){const n=new Date;!function(e,t){const n=document.createElement("a"),o=document.body;if(null===o)return;o.appendChild(n),n.style.display="none";const i=JSON.stringify(e),c=new Blob([i],{type:"octet/stream"}),a=window.URL.createObjectURL(c);n.href=a,n.download=t,n.click(),window.URL.revokeObjectURL(a),n.remove()}({editorState:e.getEditorState(),lastSaved:n.getTime(),source:t.source||"Lexical",version:"0.14.2"},`${t.fileName||n.toISOString()}.lexical`)}export{n as exportFile,t as importFile};
@@ -5,5 +5,5 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  'use strict';var f=require("lexical");function g(a){let c=document.createElement("input");c.type="file";c.accept=".lexical";c.addEventListener("change",b=>{b=b.target;if(b.files){b=b.files[0];let d=new FileReader;d.readAsText(b,"UTF-8");d.onload=e=>{e.target&&a(e.target.result)}}});c.click()}
8
- exports.exportFile=function(a,c=Object.freeze({})){var b=new Date;a={editorState:a.getEditorState(),lastSaved:b.getTime(),source:c.source||"Lexical",version:"0.14.0"};{c=`${c.fileName||b.toISOString()}.lexical`;b=document.createElement("a");let d=document.body;null!==d&&(d.appendChild(b),b.style.display="none",a=JSON.stringify(a),a=new Blob([a],{type:"octet/stream"}),a=window.URL.createObjectURL(a),b.href=a,b.download=c,b.click(),window.URL.revokeObjectURL(a),b.remove())}};
8
+ exports.exportFile=function(a,c=Object.freeze({})){var b=new Date;a={editorState:a.getEditorState(),lastSaved:b.getTime(),source:c.source||"Lexical",version:"0.14.2"};{c=`${c.fileName||b.toISOString()}.lexical`;b=document.createElement("a");let d=document.body;null!==d&&(d.appendChild(b),b.style.display="none",a=JSON.stringify(a),a=new Blob([a],{type:"octet/stream"}),a=window.URL.createObjectURL(a),b.href=a,b.download=c,b.click(),window.URL.revokeObjectURL(a),b.remove())}};
9
9
  exports.importFile=function(a){g(c=>{c=JSON.parse(c);c=a.parseEditorState(JSON.stringify(c.editorState));a.setEditorState(c);a.dispatchCommand(f.CLEAR_HISTORY_COMMAND,void 0)})}
package/package.json CHANGED
@@ -10,10 +10,10 @@
10
10
  "export"
11
11
  ],
12
12
  "license": "MIT",
13
- "version": "0.14.0",
13
+ "version": "0.14.2",
14
14
  "main": "LexicalFile.js",
15
15
  "peerDependencies": {
16
- "lexical": "0.14.0"
16
+ "lexical": "0.14.2"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",