@lexical/plain-text
Advanced tools
Comparing version 0.3.7 to 0.3.8
@@ -51,3 +51,3 @@ /** | ||
editor.update(() => { | ||
const clipboardData = event.clipboardData; | ||
const clipboardData = event instanceof KeyboardEvent ? null : event.clipboardData; | ||
const selection = lexical.$getSelection(); | ||
@@ -73,3 +73,3 @@ | ||
const selection = lexical.$getSelection(); | ||
const clipboardData = event.clipboardData; | ||
const clipboardData = event instanceof InputEvent ? null : event.clipboardData; | ||
@@ -76,0 +76,0 @@ if (clipboardData != null && lexical.$isRangeSelection(selection)) { |
@@ -8,4 +8,4 @@ /** | ||
'use strict';var a=require("@lexical/clipboard"),g=require("@lexical/selection"),k=require("@lexical/utils"),l=require("lexical");let 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); | ||
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.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.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()})} | ||
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 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.7", | ||
"version": "0.3.8", | ||
"main": "LexicalPlainText.js", | ||
"peerDependencies": { | ||
"lexical": "0.3.7", | ||
"@lexical/utils": "0.3.7", | ||
"@lexical/selection": "0.3.7", | ||
"@lexical/clipboard": "0.3.7" | ||
"lexical": "0.3.8", | ||
"@lexical/utils": "0.3.8", | ||
"@lexical/selection": "0.3.8", | ||
"@lexical/clipboard": "0.3.8" | ||
}, | ||
@@ -19,0 +19,0 @@ "repository": { |
# `@lexical/plain-text` | ||
This package contains plain text helpers for Lexical. | ||
This package provides a starting point for Lexical users by registering listeners for a set of basic commands that cover simple text-editing behavior such as entering text, deleting characters, copy + paste, or changing the selection with arrow keys. | ||
You can use this package as a starting point, and then add additional command listeners to customize the functionality of your editor. If you want to add rich-text features, such as headings, blockquotes, or formatted text, you may want to consider using [@lexical/rich-text](https://lexical.dev/docs/api/lexical-rich-text) instead. |
19914
6