@lexical/plain-text
Advanced tools
Comparing version 0.3.8 to 0.3.9
@@ -22,4 +22,3 @@ /** | ||
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'; | ||
const documentMode = // @ts-ignore | ||
CAN_USE_DOM && 'documentMode' in document ? document.documentMode : null; | ||
const documentMode = CAN_USE_DOM && 'documentMode' in document ? document.documentMode : null; | ||
CAN_USE_DOM && /Mac|iPod|iPhone|iPad/.test(navigator.platform); | ||
@@ -29,4 +28,3 @@ CAN_USE_DOM && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent); | ||
const IS_SAFARI = CAN_USE_DOM && /Version\/[\d.]+.*Safari/.test(navigator.userAgent); | ||
const IS_IOS = CAN_USE_DOM && /iPad|iPhone|iPod/.test(navigator.userAgent) && // @ts-ignore | ||
!window.MSStream; // Keep these in case we need to use them in the future. | ||
const IS_IOS = CAN_USE_DOM && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; // Keep these in case we need to use them in the future. | ||
// export const IS_WINDOWS: boolean = CAN_USE_DOM && /Win/.test(navigator.platform); | ||
@@ -79,2 +77,4 @@ // export const IS_CHROME: boolean = CAN_USE_DOM && /^(?=.*Chrome).*/i.test(navigator.userAgent); | ||
} | ||
}, { | ||
tag: 'paste' | ||
}); | ||
@@ -283,3 +283,3 @@ } | ||
// intercept that we're actually inserting a paragraph, | ||
// and autocomplete, autocapitialize etc work as intended. | ||
// and autocomplete, autocapitalize etc work as intended. | ||
// This can also cause a strange performance issue in | ||
@@ -286,0 +286,0 @@ // Safari, where there is a noticeable pause due to |
@@ -9,3 +9,3 @@ /** | ||
let p=m&&"InputEvent"in window&&!n?"getTargetRanges"in new window.InputEvent("input"):!1,q=m&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),r=m&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,t={tag:"history-merge"};function u(d,f){d.preventDefault();f.update(()=>{let e=d instanceof KeyboardEvent?null:d.clipboardData,b=l.$getSelection();if(null!==b&&null!=e){let c=a.$getHtmlContent(f);null!==c&&e.setData("text/html",c);e.setData("text/plain",b.getTextContent())}})} | ||
function v(d,f){d.preventDefault();f.update(()=>{let e=l.$getSelection(),b=d instanceof InputEvent?null:d.clipboardData;null!=b&&l.$isRangeSelection(e)&&a.$insertDataTransferForPlainText(b,e)})}function w(d,f){u(d,f);f.update(()=>{let e=l.$getSelection();l.$isRangeSelection(e)&&e.removeText()})} | ||
function v(d,f){d.preventDefault();f.update(()=>{let e=l.$getSelection(),b=d instanceof InputEvent?null:d.clipboardData;null!=b&&l.$isRangeSelection(e)&&a.$insertDataTransferForPlainText(b,e)},{tag:"paste"})}function w(d,f){u(d,f);f.update(()=>{let e=l.$getSelection();l.$isRangeSelection(e)&&e.removeText()})} | ||
function x(d,f){if(null!==f)if(void 0===f)d.update(()=>{var e=l.$getRoot();if(e.isEmpty()){let b=l.$createParagraphNode();e.append(b);e=document.activeElement;(null!==l.$getSelection()||null!==e&&e===d.getRootElement())&&b.select()}},t);else if(null!==f)switch(typeof f){case "string":let e=d.parseEditorState(f);d.setEditorState(e,t);break;case "object":d.setEditorState(f,t);break;case "function":d.update(()=>{l.$getRoot().isEmpty()&&f(d)},t)}} | ||
@@ -12,0 +12,0 @@ exports.registerPlainText=function(d,f){let e=k.mergeRegister(d.registerCommand(l.DELETE_CHARACTER_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c.deleteCharacter(b);return!0},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.DELETE_WORD_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c.deleteWord(b);return!0},l.COMMAND_PRIORITY_EDITOR),d.registerCommand(l.DELETE_LINE_COMMAND,b=>{const c=l.$getSelection();if(!l.$isRangeSelection(c))return!1;c.deleteLine(b); |
@@ -10,9 +10,9 @@ { | ||
"license": "MIT", | ||
"version": "0.3.8", | ||
"version": "0.3.9", | ||
"main": "LexicalPlainText.js", | ||
"peerDependencies": { | ||
"lexical": "0.3.8", | ||
"@lexical/utils": "0.3.8", | ||
"@lexical/selection": "0.3.8", | ||
"@lexical/clipboard": "0.3.8" | ||
"lexical": "0.3.9", | ||
"@lexical/utils": "0.3.9", | ||
"@lexical/selection": "0.3.9", | ||
"@lexical/clipboard": "0.3.9" | ||
}, | ||
@@ -19,0 +19,0 @@ "repository": { |
19923