@lexical/plain-text
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -7,5 +7,3 @@ /** | ||
* | ||
* @flow strict | ||
*/ | ||
import type {EditorState, LexicalEditor} from 'lexical'; | ||
@@ -12,0 +10,0 @@ export type InitialEditorStateType = null | string | EditorState | (() => void); |
@@ -20,20 +20,12 @@ /** | ||
* | ||
* | ||
*/ | ||
const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'; | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
*/ | ||
const documentMode = CAN_USE_DOM && 'documentMode' in document ? document.documentMode : null; | ||
const documentMode = // @ts-ignore | ||
CAN_USE_DOM && 'documentMode' in document ? document.documentMode : null; | ||
CAN_USE_DOM && /Mac|iPod|iPhone|iPad/.test(navigator.platform); | ||
CAN_USE_DOM && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent); | ||
const CAN_USE_BEFORE_INPUT = CAN_USE_DOM && 'InputEvent' in window && !documentMode ? 'getTargetRanges' in new window.InputEvent('input') : false; | ||
const IS_SAFARI = CAN_USE_DOM && /Version\/[\d\.]+.*Safari/.test(navigator.userAgent); | ||
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. | ||
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. | ||
// export const IS_WINDOWS: boolean = CAN_USE_DOM && /Win/.test(navigator.platform); | ||
@@ -49,3 +41,2 @@ // export const IS_CHROME: boolean = CAN_USE_DOM && /^(?=.*Chrome).*/i.test(navigator.userAgent); | ||
* | ||
* | ||
*/ | ||
@@ -196,3 +187,3 @@ // Convoluted logic to make this work with Flow. Order matters. | ||
return true; | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.REMOVE_TEXT_COMMAND, payload => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.REMOVE_TEXT_COMMAND, () => { | ||
const selection = lexical.$getSelection(); | ||
@@ -215,3 +206,3 @@ | ||
return true; | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.INSERT_PARAGRAPH_COMMAND, payload => { | ||
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.INSERT_PARAGRAPH_COMMAND, () => { | ||
const selection = lexical.$getSelection(); | ||
@@ -218,0 +209,0 @@ |
@@ -8,3 +8,3 @@ /** | ||
var a=require("@lexical/clipboard"),g=require("@lexical/selection"),k=require("@lexical/utils"),l=require("lexical");const m="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,n=m&&"documentMode"in document?document.documentMode:null;m&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);m&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent); | ||
const 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,e){d.preventDefault();e.update(()=>{const f=d.clipboardData,b=l.$getSelection();if(null!==b&&null!=f){const c=a.$getHtmlContent(e);null!==c&&f.setData("text/html",c);f.setData("text/plain",b.getTextContent())}})} | ||
const 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,e){d.preventDefault();e.update(()=>{const f=d.clipboardData,b=l.$getSelection();if(null!==b&&null!=f){const c=a.$getHtmlContent(e);null!==c&&f.setData("text/html",c);f.setData("text/plain",b.getTextContent())}})} | ||
function v(d,e){d.preventDefault();e.update(()=>{const f=l.$getSelection(),b=d.clipboardData;null!=b&&l.$isRangeSelection(f)&&a.$insertDataTransferForPlainText(b,f)})}function w(d,e){u(d,e);e.update(()=>{const f=l.$getSelection();l.$isRangeSelection(f)&&f.removeText()})} | ||
@@ -11,0 +11,0 @@ function x(d,e){if(null!==e)if(void 0===e)d.update(()=>{var f=l.$getRoot();if(null===f.getFirstChild()){const b=l.$createParagraphNode();f.append(b);f=document.activeElement;(null!==l.$getSelection()||null!==f&&f===d.getRootElement())&&b.select()}},t);else if(null!==e)switch(typeof e){case "string":e=d.parseEditorState(e);d.setEditorState(e,t);break;case "object":d.setEditorState(e,t);break;case "function":d.update(e,t)}} |
@@ -10,9 +10,9 @@ { | ||
"license": "MIT", | ||
"version": "0.2.7", | ||
"main": "LexicalPlainText.js", | ||
"version": "0.2.8", | ||
"main": "LexicalPlainText.ts", | ||
"peerDependencies": { | ||
"lexical": "0.2.7", | ||
"@lexical/utils": "0.2.7", | ||
"@lexical/selection": "0.2.7", | ||
"@lexical/clipboard": "0.2.7" | ||
"lexical": "0.2.8", | ||
"@lexical/utils": "0.2.8", | ||
"@lexical/selection": "0.2.8", | ||
"@lexical/clipboard": "0.2.8" | ||
}, | ||
@@ -19,0 +19,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19051
326