@lexical/file 0.14.3 → 0.14.5
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/index.d.ts +0 -1
- package/package.json +6 -2
package/LexicalFile.dev.js
CHANGED
package/LexicalFile.dev.mjs
CHANGED
package/LexicalFile.prod.js
CHANGED
|
@@ -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.
|
|
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.5"};{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/LexicalFile.prod.mjs
CHANGED
|
@@ -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.
|
|
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.5"},`${t.fileName||n.toISOString()}.lexical`)}export{n as exportFile,t as importFile};
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"export"
|
|
11
11
|
],
|
|
12
12
|
"license": "MIT",
|
|
13
|
-
"version": "0.14.
|
|
13
|
+
"version": "0.14.5",
|
|
14
14
|
"main": "LexicalFile.js",
|
|
15
15
|
"types": "index.d.ts",
|
|
16
16
|
"repository": {
|
|
@@ -24,16 +24,20 @@
|
|
|
24
24
|
".": {
|
|
25
25
|
"import": {
|
|
26
26
|
"types": "./index.d.ts",
|
|
27
|
+
"development": "./LexicalFile.dev.mjs",
|
|
28
|
+
"production": "./LexicalFile.prod.mjs",
|
|
27
29
|
"node": "./LexicalFile.node.mjs",
|
|
28
30
|
"default": "./LexicalFile.mjs"
|
|
29
31
|
},
|
|
30
32
|
"require": {
|
|
31
33
|
"types": "./index.d.ts",
|
|
34
|
+
"development": "./LexicalFile.dev.js",
|
|
35
|
+
"production": "./LexicalFile.prod.js",
|
|
32
36
|
"default": "./LexicalFile.js"
|
|
33
37
|
}
|
|
34
38
|
}
|
|
35
39
|
},
|
|
36
40
|
"dependencies": {
|
|
37
|
-
"lexical": "0.14.
|
|
41
|
+
"lexical": "0.14.5"
|
|
38
42
|
}
|
|
39
43
|
}
|