@lexical/file
Advanced tools
Comparing version 0.7.1 to 0.7.2
@@ -11,2 +11,4 @@ /** | ||
var version = "0.7.2"; | ||
/** | ||
@@ -58,3 +60,3 @@ * Copyright (c) Meta Platforms, Inc. and affiliates. | ||
source: config.source || 'Lexical', | ||
version: lexical.VERSION | ||
version | ||
}; | ||
@@ -61,0 +63,0 @@ const fileName = config.fileName || now.toISOString(); |
@@ -7,4 +7,4 @@ /** | ||
*/ | ||
'use strict';var e=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=f=>{f.target&&a(f.target.result)}}});c.click()} | ||
exports.exportFile=function(a,c=Object.freeze({})){var b=new Date;a={editorState:a.getEditorState(),lastSaved:b.getTime(),source:c.source||"Lexical",version:e.VERSION};{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())}}; | ||
exports.importFile=function(a){g(c=>{c=JSON.parse(c);c=a.parseEditorState(JSON.stringify(c.editorState));a.setEditorState(c);a.dispatchCommand(e.CLEAR_HISTORY_COMMAND,void 0)})} | ||
'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()} | ||
exports.exportFile=function(a,c=Object.freeze({})){var b=new Date;a={editorState:a.getEditorState(),lastSaved:b.getTime(),source:c.source||"Lexical",version:"0.7.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())}}; | ||
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)})} |
@@ -13,6 +13,6 @@ { | ||
"license": "MIT", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"main": "LexicalFile.js", | ||
"peerDependencies": { | ||
"lexical": "0.7.1" | ||
"lexical": "0.7.2" | ||
}, | ||
@@ -19,0 +19,0 @@ "repository": { |
6684
119