@lexical/file 0.20.1 → 0.20.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.
- package/LexicalFile.dev.js +1 -1
- package/LexicalFile.dev.mjs +1 -1
- package/LexicalFile.prod.js +1 -1
- package/LexicalFile.prod.mjs +1 -1
- package/package.json +2 -2
package/LexicalFile.dev.js
CHANGED
package/LexicalFile.dev.mjs
CHANGED
package/LexicalFile.prod.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
'use strict';var e=require("lexical");function f(a,b=Object.freeze({})){return{editorState:a.toJSON(),lastSaved:b.lastSaved||Date.now(),source:b.source||"Lexical",version:"0.20.
|
|
9
|
+
'use strict';var e=require("lexical");function f(a,b=Object.freeze({})){return{editorState:a.toJSON(),lastSaved:b.lastSaved||Date.now(),source:b.source||"Lexical",version:"0.20.2"}}function h(a,b){b="string"===typeof b?JSON.parse(b):b;return a.parseEditorState(b.editorState)}
|
|
10
10
|
function k(a){let b=document.createElement("input");b.type="file";b.accept=".lexical";b.addEventListener("change",c=>{c=c.target;if(c.files){c=c.files[0];let d=new FileReader;d.readAsText(c,"UTF-8");d.onload=g=>{g.target&&a(g.target.result)}}});b.click()}exports.editorStateFromSerializedDocument=h;
|
|
11
11
|
exports.exportFile=function(a,b=Object.freeze({})){var c=new Date;a=f(a.getEditorState(),{...b,lastSaved:c.getTime()});{b=`${b.fileName||c.toISOString()}.lexical`;c=document.createElement("a");let d=document.body;null!==d&&(d.appendChild(c),c.style.display="none",a=JSON.stringify(a),a=new Blob([a],{type:"octet/stream"}),a=window.URL.createObjectURL(a),c.href=a,c.download=b,c.click(),window.URL.revokeObjectURL(a),c.remove())}};
|
|
12
12
|
exports.importFile=function(a){k(b=>{a.setEditorState(h(a,b));a.dispatchCommand(e.CLEAR_HISTORY_COMMAND,void 0)})};exports.serializedDocumentFromEditorState=f
|
package/LexicalFile.prod.mjs
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{CLEAR_HISTORY_COMMAND as e}from"lexical";var t="0.20.
|
|
9
|
+
import{CLEAR_HISTORY_COMMAND as e}from"lexical";var t="0.20.2";function n(e,n=Object.freeze({})){return{editorState:e.toJSON(),lastSaved:n.lastSaved||Date.now(),source:n.source||"Lexical",version:t}}function o(e,t){const n="string"==typeof t?JSON.parse(t):t;return e.parseEditorState(n.editorState)}function a(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=>{t.setEditorState(o(t,n)),t.dispatchCommand(e,void 0)}))}function i(e,t=Object.freeze({})){const o=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 a=JSON.stringify(e),i=new Blob([a],{type:"octet/stream"}),c=window.URL.createObjectURL(i);n.href=c,n.download=t,n.click(),window.URL.revokeObjectURL(c),n.remove()}(n(e.getEditorState(),{...t,lastSaved:o.getTime()}),`${t.fileName||o.toISOString()}.lexical`)}export{o as editorStateFromSerializedDocument,i as exportFile,a as importFile,n as serializedDocumentFromEditorState};
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"export"
|
|
11
11
|
],
|
|
12
12
|
"license": "MIT",
|
|
13
|
-
"version": "0.20.
|
|
13
|
+
"version": "0.20.2",
|
|
14
14
|
"main": "LexicalFile.js",
|
|
15
15
|
"types": "index.d.ts",
|
|
16
16
|
"repository": {
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"lexical": "0.20.
|
|
41
|
+
"lexical": "0.20.2"
|
|
42
42
|
}
|
|
43
43
|
}
|