@lexical/file 0.14.4 → 0.15.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.
- package/LexicalFile.dev.js +4 -1
- package/LexicalFile.dev.mjs +4 -1
- package/LexicalFile.js +2 -0
- package/LexicalFile.mjs +2 -0
- package/LexicalFile.node.mjs +2 -0
- package/LexicalFile.prod.js +3 -1
- package/LexicalFile.prod.mjs +3 -1
- package/package.json +2 -2
package/LexicalFile.dev.js
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
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');
|
|
10
12
|
|
|
11
|
-
var version = "0.
|
|
13
|
+
var version = "0.15.0";
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -18,6 +20,7 @@ var version = "0.14.4";
|
|
|
18
20
|
*
|
|
19
21
|
*/
|
|
20
22
|
|
|
23
|
+
|
|
21
24
|
/**
|
|
22
25
|
* Takes a file and inputs its content into the editor state as an input field.
|
|
23
26
|
* @param editor - The lexical editor.
|
package/LexicalFile.dev.mjs
CHANGED
|
@@ -3,10 +3,12 @@
|
|
|
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 { CLEAR_HISTORY_COMMAND } from 'lexical';
|
|
8
10
|
|
|
9
|
-
var version = "0.
|
|
11
|
+
var version = "0.15.0";
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -16,6 +18,7 @@ var version = "0.14.4";
|
|
|
16
18
|
*
|
|
17
19
|
*/
|
|
18
20
|
|
|
21
|
+
|
|
19
22
|
/**
|
|
20
23
|
* Takes a file and inputs its content into the editor state as an input field.
|
|
21
24
|
* @param editor - The lexical editor.
|
package/LexicalFile.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 LexicalFile = process.env.NODE_ENV === 'development' ? require('./LexicalFile.dev.js') : require('./LexicalFile.prod.js');
|
|
9
11
|
module.exports = LexicalFile;
|
package/LexicalFile.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 './LexicalFile.dev.mjs';
|
|
8
10
|
import * as modProd from './LexicalFile.prod.mjs';
|
|
9
11
|
const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
|
package/LexicalFile.node.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
|
const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalFile.dev.mjs') : import('./LexicalFile.prod.mjs'));
|
|
8
10
|
export const exportFile = mod.exportFile;
|
|
9
11
|
export const importFile = mod.importFile;
|
package/LexicalFile.prod.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';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.
|
|
10
|
+
exports.exportFile=function(a,c=Object.freeze({})){var b=new Date;a={editorState:a.getEditorState(),lastSaved:b.getTime(),source:c.source||"Lexical",version:"0.15.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())}};
|
|
9
11
|
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
|
@@ -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
|
*/
|
|
7
|
-
|
|
8
|
+
|
|
9
|
+
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.15.0"},`${t.fileName||n.toISOString()}.lexical`)}export{n as exportFile,t as importFile};
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"export"
|
|
11
11
|
],
|
|
12
12
|
"license": "MIT",
|
|
13
|
-
"version": "0.
|
|
13
|
+
"version": "0.15.0",
|
|
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.
|
|
41
|
+
"lexical": "0.15.0"
|
|
42
42
|
}
|
|
43
43
|
}
|