mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-10-26 16:55:08 +00:00
fix(client): preserve composer position above mobile keyboards
Patch Lexical viewport coordinates and cover keyboard panning in editor and browser regressions. Update the patch disclosure.
This commit is contained in:
1 parent
c29a313379
commit
c503b51a94
10 files changed
+209
-17
No files matched your search
@@ -41,6 +41,7 @@ External packages installed for runtime use or embedded in distributed Host or b
|
||||
| [`@earendil-works/pi-ai`](https://github.com/earendil-works/pi) | MIT |
|
||||
| [`@earendil-works/pi-coding-agent`](https://github.com/earendil-works/pi) | MIT |
|
||||
| [`@eslint-community/regexpp`](https://github.com/eslint-community/regexpp) | MIT |
|
||||
| [`@floating-ui/dom`](https://github.com/floating-ui/floating-ui) | MIT |
|
||||
| [`@fortune-sheet/core`](https://github.com/ruilisi/fortune-sheet) | MIT |
|
||||
| [`@fortune-sheet/react`](https://github.com/ruilisi/fortune-sheet) | MIT |
|
||||
| [`@joplin/turndown-plugin-gfm`](https://github.com/laurent22/joplin-turndown-plugin-gfm) | MIT |
|
||||
@@ -159,6 +160,7 @@ pnpm applies local patches to the following packages at install time, so shipped
|
||||
- `@yao-pkg/pkg@6.21.0` — [`patches/@yao-pkg__pkg@6.21.0.patch`](patches/@yao-pkg__pkg@6.21.0.patch)
|
||||
- `app-builder-lib@26.17.0` — [`patches/app-builder-lib@26.17.0.patch`](patches/app-builder-lib@26.17.0.patch)
|
||||
- `exceljs@4.4.0` — [`patches/exceljs@4.4.0.patch`](patches/exceljs@4.4.0.patch)
|
||||
- `lexical@0.49.0` — [`patches/lexical@0.49.0.patch`](patches/lexical@0.49.0.patch)
|
||||
- `node-pty@1.2.0-beta.15` — [`patches/node-pty@1.2.0-beta.15.patch`](patches/node-pty@1.2.0-beta.15.patch)
|
||||
|
||||
## Chrome DevTools frontend
|
||||
|
||||
@@ -39,6 +39,51 @@ function describeSelection(state: Awaited<ReturnType<typeof selectionState>>): s
|
||||
return `${state.focused ? 'focused' : 'unfocused'}; selection ${JSON.stringify(state.text)} (${state.anchor} → ${state.focus})`
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep the visible composer still when keyboard panning changes viewport coordinates.
|
||||
* @param page - Page with the focused composer.
|
||||
* @returns The observed page and composer scroll behavior.
|
||||
*/
|
||||
async function exerciseKeyboardViewport(page: Page): Promise<string> {
|
||||
const input = page.locator('[data-composer-input][contenteditable="true"]')
|
||||
const restore = await page.evaluateHandle(() => {
|
||||
const viewport = window.visualViewport
|
||||
if (viewport === null) throw new Error('Expected a visual viewport')
|
||||
const style = document.documentElement.style
|
||||
const height = style.getPropertyValue('height')
|
||||
const priority = style.getPropertyPriority('height')
|
||||
const scroll = window.scrollY
|
||||
const offset = Object.getOwnPropertyDescriptor(viewport, 'offsetTop')
|
||||
style.setProperty('height', `${window.innerHeight * 2}px`)
|
||||
window.scrollTo(0, window.innerHeight)
|
||||
// Safari can report the keyboard's page displacement as offsetTop even
|
||||
// though DOM rectangles already account for that page scroll.
|
||||
Object.defineProperty(viewport, 'offsetTop', { configurable: true, get: () => window.scrollY })
|
||||
return () => {
|
||||
if (offset === undefined) Reflect.deleteProperty(viewport, 'offsetTop')
|
||||
else Object.defineProperty(viewport, 'offsetTop', offset)
|
||||
if (height === '') style.removeProperty('height')
|
||||
else style.setProperty('height', height, priority)
|
||||
window.scrollTo(0, scroll)
|
||||
}
|
||||
})
|
||||
try {
|
||||
const before = await input.evaluate(el => ({ top: el.getBoundingClientRect().top, scroll: window.scrollY }))
|
||||
expect(before.scroll).toBeGreaterThan(0)
|
||||
await page.keyboard.insertText('z')
|
||||
const after = await input.evaluate(el => new Promise<{ top: number; scroll: number }>((resolve) => {
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => {
|
||||
resolve({ top: el.getBoundingClientRect().top, scroll: window.scrollY })
|
||||
}))
|
||||
}))
|
||||
expect(after).toEqual(before)
|
||||
return '- typing with a keyboard-panned viewport preserves page scroll and composer position'
|
||||
} finally {
|
||||
await restore.evaluate((dispose) => { dispose() })
|
||||
await restore.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exercise the card's top, inter-row gap, toolbar gap and bottom padding.
|
||||
* @param page - Page containing an editable composer.
|
||||
@@ -113,6 +158,15 @@ async function exerciseComposer(page: Page): Promise<string[]> {
|
||||
await page.keyboard.insertText('!')
|
||||
await expect.poll(() => input.textContent()).toBe('alpha BET!A gamma')
|
||||
observations.push(`- typing replaces the restored selection and resumes at the restored caret: ${await input.textContent()}`)
|
||||
const retained = await input.elementHandle()
|
||||
const beforeResize = await selectionState(page)
|
||||
for (const width of [390, 768, 1680]) {
|
||||
await page.setViewportSize({ width, height: 1000 })
|
||||
expect(await retained!.evaluate(element => element.isConnected)).toBe(true)
|
||||
expect(await selectionState(page)).toEqual(beforeResize)
|
||||
}
|
||||
observations.push('- resizing through 390px, 768px and 1680px preserves the editor, focus, draft and caret')
|
||||
observations.push(await exerciseKeyboardViewport(page))
|
||||
return observations
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
- bottom padding: focused; selection "beta" (10 → 6)
|
||||
- return from outside: focused; selection "beta" (10 → 6)
|
||||
- typing replaces the restored selection and resumes at the restored caret: alpha BET!A gamma
|
||||
- resizing through 390px, 768px and 1680px preserves the editor, focus, draft and caret
|
||||
- typing with a keyboard-panned viewport preserves page scroll and composer position
|
||||
|
||||
## Existing session
|
||||
|
||||
@@ -17,3 +19,5 @@
|
||||
- bottom padding: focused; selection "beta" (10 → 6)
|
||||
- return from outside: focused; selection "beta" (10 → 6)
|
||||
- typing replaces the restored selection and resumes at the restored caret: alpha BET!A gamma
|
||||
- resizing through 390px, 768px and 1680px preserves the editor, focus, draft and caret
|
||||
- typing with a keyboard-panned viewport preserves page scroll and composer position
|
||||
@@ -21,8 +21,8 @@
|
||||
en: 9912b286384c41d7
|
||||
zh: 3e994887c1948677
|
||||
/deepseek-ai-dsh-client-ui-conversation/shell-and-standard-props:
|
||||
en: fce20a7d042b1d29
|
||||
zh: 0f8e4faff447df6f
|
||||
en: 74566fff43564bfe
|
||||
zh: 4944512f461a08b0
|
||||
/deepseek-ai-dsh-client-ui-conversation/temporary-composer-entries:
|
||||
en: bb1244310f5c0382
|
||||
zh: 824b84077432b559
|
||||
|
||||
@@ -68,7 +68,7 @@ The composer measures its expanded control groups after size, content, visibilit
|
||||
|
||||
The context meter follows the [statistics-control radius](../../../docs/ui-radius.md#radius-scale).
|
||||
|
||||
The composer uses the shared [text-input focus policy](../ui-primitives/README.md#use-this-package) on mount, Session switching, and unlock. Identified phones and tablets require tapping the input; desktop devices retain automatic focus.
|
||||
The composer uses the shared [text-input focus policy](../ui-primitives/README.md#use-this-package) on mount, Session switching, and unlock. Identified phones and tablets require tapping the input; desktop devices retain automatic focus. The [Lexical patch](../../../patches/lexical@0.49.0.patch) keeps caret scrolling in the same coordinate system as DOM geometry when a mobile keyboard pans the page.
|
||||
|
||||
The context-occupancy button shows a ring and percentage below the input card, after the Session statistics. Clicking it opens the token breakdown in a panel kept inside the viewport, including when no statistics are shown; the button stays hidden until context usage and capacity are available.
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ Queue 预览启用空白折叠和文档边缘 trim,保留 emoji,并使用 CS
|
||||
|
||||
上下文占用率入口遵循[统计控件圆角规则](../../../docs/ui-radius.zh.md#radius-scale)。
|
||||
|
||||
composer 在挂载、切换 Session 和解除锁定时使用共享的[文字输入框聚焦策略](../ui-primitives/README.zh.md#use-this-package)。识别出的手机和平板需要点击输入框;桌面设备保留自动聚焦。
|
||||
composer 在挂载、切换 Session 和解除锁定时使用共享的[文字输入框聚焦策略](../ui-primitives/README.zh.md#use-this-package)。识别出的手机和平板需要点击输入框;桌面设备保留自动聚焦。移动端键盘平移页面时,[Lexical 补丁](../../../patches/lexical@0.49.0.patch)让光标滚动计算与 DOM 几何使用同一坐标系。
|
||||
|
||||
上下文占用按钮在输入卡片下方、会话统计右侧显示圆环和百分比。点击按钮可在视口内的面板查看 token 构成,没有统计项时面板也不会越界;上下文用量和容量尚不可用时,按钮保持隐藏。
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
// @vitest-environment jsdom
|
||||
/** Composer caret visibility across page scrolling and virtual-keyboard viewport changes. */
|
||||
import { expect, it, onTestFinished, vi } from 'vitest'
|
||||
import { DraftEditorRuntime } from '../src/client/input/editor/runtime.ts'
|
||||
|
||||
function fixture(viewport: { height: number; offsetTop: number; pageTop: number } | undefined, pageScroll: number) {
|
||||
// jsdom has no visual viewport or Range geometry; use the browser measurements
|
||||
// while leaving Lexical's DOM selection and scrolling decisions intact.
|
||||
vi.stubGlobal('visualViewport', viewport)
|
||||
vi.stubGlobal('scrollY', pageScroll)
|
||||
vi.stubGlobal('innerHeight', 600)
|
||||
const scrollBy = vi.spyOn(window, 'scrollBy').mockImplementation(() => {})
|
||||
const geometry = Object.getOwnPropertyDescriptor(Range.prototype, 'getBoundingClientRect')
|
||||
let caret = new DOMRect(20, 169, 0, 26)
|
||||
Object.defineProperty(Range.prototype, 'getBoundingClientRect', {
|
||||
configurable: true,
|
||||
value: () => caret,
|
||||
})
|
||||
const root = document.createElement('div')
|
||||
root.setAttribute('contenteditable', 'true')
|
||||
root.tabIndex = 0
|
||||
root.getBoundingClientRect = () => new DOMRect(0, 0, 400, 1000)
|
||||
document.body.append(root)
|
||||
const runtime: DraftEditorRuntime = new DraftEditorRuntime({
|
||||
onUpdate: () => { runtime.refreshProjection() },
|
||||
openReference: () => false, activeClaimToken: () => null,
|
||||
lexicon: () => new Map(), resolveLexicon: () => undefined,
|
||||
})
|
||||
const dispose = runtime.register()
|
||||
onTestFinished(() => {
|
||||
dispose()
|
||||
root.remove()
|
||||
scrollBy.mockRestore()
|
||||
if (geometry === undefined) Reflect.deleteProperty(Range.prototype, 'getBoundingClientRect')
|
||||
else Object.defineProperty(Range.prototype, 'getBoundingClientRect', geometry)
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
runtime.editor.setRootElement(root)
|
||||
root.focus({ preventScroll: true })
|
||||
scrollBy.mockClear()
|
||||
return {
|
||||
scrollBy,
|
||||
typeAt(top: number): void {
|
||||
caret = new DOMRect(20, top, 0, 26)
|
||||
runtime.setDraft('a')
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
it('keeps a visible caret still after Safari pans the page above the keyboard', () => {
|
||||
const f = fixture({ height: 376, offsetTop: 196, pageTop: 196 }, 196)
|
||||
f.typeAt(169)
|
||||
expect(f.scrollBy).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('reveals a caret below the keyboard after the page has scrolled', () => {
|
||||
const f = fixture({ height: 376, offsetTop: 196, pageTop: 196 }, 196)
|
||||
f.typeAt(410)
|
||||
expect(f.scrollBy).toHaveBeenCalledExactlyOnceWith(0, 60)
|
||||
})
|
||||
|
||||
it('retains visual viewport panning relative to an already scrolled page', () => {
|
||||
const f = fixture({ height: 376, offsetTop: 150, pageTop: 350 }, 200)
|
||||
f.typeAt(100)
|
||||
expect(f.scrollBy).toHaveBeenCalledExactlyOnceWith(0, -50)
|
||||
})
|
||||
|
||||
it('uses the window height when the browser has no visual viewport', () => {
|
||||
const f = fixture(undefined, 200)
|
||||
f.typeAt(630)
|
||||
expect(f.scrollBy).toHaveBeenCalledExactlyOnceWith(0, 56)
|
||||
})
|
||||
@@ -0,0 +1,58 @@
|
||||
diff --git a/dist/Lexical.dev.js b/dist/Lexical.dev.js
|
||||
index 7c6fbcfbbfdda3f79d3b41bec1640e60e1df479c..5423063a9ce8e4a8f9da6fc25ee9d59c4997a7ac 100644
|
||||
--- a/dist/Lexical.dev.js
|
||||
+++ b/dist/Lexical.dev.js
|
||||
@@ -16346,7 +16346,8 @@ function scrollIntoViewIfNeeded(editor, selectionRect, rootElement) {
|
||||
// or the caret stays behind the keyboard.
|
||||
const visualViewport = defaultView.visualViewport;
|
||||
if (visualViewport) {
|
||||
- const offsetTop = visualViewport.offsetTop;
|
||||
+ // Match getBoundingClientRect coordinates when a keyboard pans the page.
|
||||
+ const offsetTop = visualViewport.pageTop - defaultView.scrollY;
|
||||
targetTop = offsetTop;
|
||||
targetBottom = offsetTop + visualViewport.height;
|
||||
} else {
|
||||
diff --git a/dist/Lexical.dev.mjs b/dist/Lexical.dev.mjs
|
||||
index 32aeb4eb929ac82d05988992e97ab3204bf698b4..6390ccb612b7363c8fa959c3b880bd8785f210a0 100644
|
||||
--- a/dist/Lexical.dev.mjs
|
||||
+++ b/dist/Lexical.dev.mjs
|
||||
@@ -16344,7 +16344,8 @@ function scrollIntoViewIfNeeded(editor, selectionRect, rootElement) {
|
||||
// or the caret stays behind the keyboard.
|
||||
const visualViewport = defaultView.visualViewport;
|
||||
if (visualViewport) {
|
||||
- const offsetTop = visualViewport.offsetTop;
|
||||
+ // Match getBoundingClientRect coordinates when a keyboard pans the page.
|
||||
+ const offsetTop = visualViewport.pageTop - defaultView.scrollY;
|
||||
targetTop = offsetTop;
|
||||
targetBottom = offsetTop + visualViewport.height;
|
||||
} else {
|
||||
diff --git a/dist/Lexical.prod.js b/dist/Lexical.prod.js
|
||||
index ab333382f19e0e5dd6a8b0529f565f1731f275a0..e1e5b60124ed3daace2310c75f2720ec67d6c1d9 100644
|
||||
--- a/dist/Lexical.prod.js
|
||||
+++ b/dist/Lexical.prod.js
|
||||
@@ -9,2 +9,2 @@
|
||||
"use strict";function t(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function e(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);n.search=o.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const n="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,o=n&&"documentMode"in document?document.documentMode:null,r=n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),s=n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),i=!(!n||!("InputEvent"in window)||o)&&"getTargetRanges"in new window.InputEvent("input"),l=n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,c=n&&/Android/.test(navigator.userAgent),a=n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!c,u=n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f=n&&c&&u,d=n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&r&&!u,h=0,g=1,_=2,p=128,m=1,y=2,x=3,C=4,S=5,T=6,N=a||l||d?"\xa0":"\u200b",v="\n\n",E=s?"\xa0":N,k="\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc",O="A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff",b=new RegExp("^[^"+O+"]*["+k+"]"),M=new RegExp("^[^"+k+"]*["+O+"]"),A={bold:1,capitalize:1024,code:16,highlight:p,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},D={directionless:1,unmergeable:2},w={center:2,end:6,justify:4,left:1,right:3,start:5},I={[y]:"center",[T]:"end",[C]:"justify",[m]:"left",[x]:"right",[S]:"start"},P={normal:0,segmented:2,token:1},F={[h]:"normal",[_]:"segmented",[g]:"token"},R="$config";function L(){return Ml()._blockCursorElement}function K(t){return null!==t&&1===t.nodeType&&t.hasAttribute("data-lexical-slot")}class B{element;before;after;constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null}withBefore(t){return new B(this.element,t,this.after)}withAfter(t){return new B(this.element,this.before,t)}withElement(t){return this.element===t?this:new B(t,this.before,this.after)}insertChild(e){const n=this.getInsertionAnchor();return null!==n&&n.parentElement!==this.element&&t(357),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(358),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(359),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;return e===this.getInsertionAnchor()?null:e}getFirstChildAnchor(){return this.after}resolveLeafPosition(t,e,n){if(this.element===t)return e===t&&0===n?"before":"after";const o=$(t,this.element);if(null===o)return"after";const r=Array.prototype.indexOf.call(t.childNodes,o);if(r<0)return"after";if(e===t)return n<=r?"before":"after";const s=$(t,e);if(null===s)return"after";const i=Array.prototype.indexOf.call(t.childNodes,s);return i>=0&&i<=r?"before":"after"}getInsertionAnchor(){return this.before}}function $(t,e){let n=e;for(;null!==n&&n.parentNode!==t;)n=n.parentNode;return n}class z extends B{withBefore(t){return new z(this.element,t,this.after)}withAfter(t){return new z(this.element,this.before,t)}withElement(t){return this.element===t?this:new z(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let t=super.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;for(;K(e);)t=e,e=e.nextSibling;const n=t?t.nextSibling:this.element.firstChild;return null!==n&&n===L()?n:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(this.element.__lexicalLastChildKind=t,null===t)this.removeManagedLineBreak();else{const e="decorator"===t&&(d||l||a);this.insertManagedLineBreak(e)}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,n="IMG"===t.nodeName?t.nextSibling:null;n&&e.removeChild(n),e.removeChild(t),e.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===("IMG"===e.nodeName))return;this.removeManagedLineBreak()}const n=this.element,o=this.before,r=fl().createElement("br");if(r.setAttribute("data-lexical-managed-linebreak","true"),n.insertBefore(r,o),t){const t=fl().createElement("img");t.setAttribute("data-lexical-managed-linebreak","true"),t.style.setProperty("display","inline","important"),t.style.setProperty("border","0px","important"),t.style.setProperty("margin","0px","important"),t.alt="",n.insertBefore(t,r),n.__lexicalLineBreak=t}else n.__lexicalLin
Line truncated
|
||||
-/*@__INLINE__*/function Te(t){return{type:t}}const Ne=/* @__PURE__ */Te("SELECTION_CHANGE_COMMAND"),ve=/* @__PURE__ */Te("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Ee=/* @__PURE__ */Te("CLICK_COMMAND"),ke=/* @__PURE__ */Te("BEFORE_INPUT_COMMAND"),Oe=/* @__PURE__ */Te("INPUT_COMMAND"),be=/* @__PURE__ */Te("COMPOSITION_START_COMMAND"),Me=/* @__PURE__ */Te("COMPOSITION_END_COMMAND"),Ae=/* @__PURE__ */Te("DELETE_CHARACTER_COMMAND"),De=/* @__PURE__ */Te("INSERT_LINE_BREAK_COMMAND"),we=/* @__PURE__ */Te("INSERT_PARAGRAPH_COMMAND"),Ie=/* @__PURE__ */Te("CONTROLLED_TEXT_INSERTION_COMMAND"),Pe=/* @__PURE__ */Te("PASTE_COMMAND"),Fe=/* @__PURE__ */Te("REMOVE_TEXT_COMMAND"),Re=/* @__PURE__ */Te("DELETE_WORD_COMMAND"),Le=/* @__PURE__ */Te("DELETE_LINE_COMMAND"),Ke=/* @__PURE__ */Te("FORMAT_TEXT_COMMAND"),Be=/* @__PURE__ */Te("SET_TEXT_FORMAT_COMMAND"),$e=/* @__PURE__ */Te("UNDO_COMMAND"),ze=/* @__PURE__ */Te("REDO_COMMAND"),We=/* @__PURE__ */Te("KEYDOWN_COMMAND"),Ue=/* @__PURE__ */Te("KEY_ARROW_RIGHT_COMMAND"),He=/* @__PURE__ */Te("MOVE_TO_END"),je=/* @__PURE__ */Te("KEY_ARROW_LEFT_COMMAND"),Ye=/* @__PURE__ */Te("MOVE_TO_START"),Ge=/* @__PURE__ */Te("KEY_ARROW_UP_COMMAND"),Je=/* @__PURE__ */Te("KEY_ARROW_DOWN_COMMAND"),Ve=/* @__PURE__ */Te("KEY_ENTER_COMMAND"),qe=/* @__PURE__ */Te("KEY_SPACE_COMMAND"),Xe=/* @__PURE__ */Te("KEY_BACKSPACE_COMMAND"),Qe=/* @__PURE__ */Te("KEY_ESCAPE_COMMAND"),Ze=/* @__PURE__ */Te("KEY_DELETE_COMMAND"),tn=/* @__PURE__ */Te("KEY_TAB_COMMAND"),en=/* @__PURE__ */Te("INSERT_TAB_COMMAND"),nn=/* @__PURE__ */Te("INDENT_CONTENT_COMMAND"),on=/* @__PURE__ */Te("OUTDENT_CONTENT_COMMAND"),rn=/* @__PURE__ */Te("DROP_COMMAND"),sn=/* @__PURE__ */Te("FORMAT_ELEMENT_COMMAND"),ln=/* @__PURE__ */Te("DRAGSTART_COMMAND"),cn=/* @__PURE__ */Te("DRAGOVER_COMMAND"),an=/* @__PURE__ */Te("DRAGEND_COMMAND"),un=/* @__PURE__ */Te("COPY_COMMAND"),fn=/* @__PURE__ */Te("CUT_COMMAND"),dn=/* @__PURE__ */Te("SELECT_ALL_COMMAND"),hn=/* @__PURE__ */Te("CLEAR_EDITOR_COMMAND"),gn=/* @__PURE__ */Te("CLEAR_HISTORY_COMMAND"),_n=/* @__PURE__ */Te("CAN_REDO_COMMAND"),pn=/* @__PURE__ */Te("CAN_UNDO_COMMAND"),mn=/* @__PURE__ */Te("FOCUS_COMMAND"),yn=/* @__PURE__ */Te("BLUR_COMMAND"),xn=/* @__PURE__ */Te("KEY_MODIFIER_COMMAND");function Cn(t){const e=new Map;return{dispose(){for(const t of e.values())t.dispose();e.clear()},register(n,o){let r=e.get(n);void 0===r&&(r={dispose:t(n,o),holders:new Set},e.set(n,r));const s=()=>{const t=e.get(n);t&&t.holders.delete(s)&&0===t.holders.size&&(e.delete(n),t.dispose())};return r.holders.add(s),s}}}function Sn(t,e,n,o){return t.addEventListener(e,n,o),t.removeEventListener.bind(t,e,n,o)}const Tn=Object.freeze({}),Nn=[["keydown",function(t,e){const n=e._inputState;n.lastKeyDownTimeStamp=t.timeStamp,n.lastKeyCode=t.key,"Backspace"!==t.key&&Pn(n);if(e.isComposing())return;Bi(e,We,t)}],["pointerdown",function(t,e){const n=Cl(t),o=t.pointerType;Tl(n)&&"touch"!==o&&"pen"!==o&&0===t.button&&is(e,()=>{Hl(n,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(t,e){Bi(e,be,t)}],["compositionend",function(t,e){const n=e._inputState;s?n.compositionPhase="ending-firefox":l||!a&&!d?Bi(e,Me,t):(n.compositionPhase="ending-safari",n.compositionEndData=t.data)}],["input",function(t,e){t.stopPropagation();const n=e._inputState;Pn(n),is(e,()=>{Rn(t,e)||e.dispatchCommand(Oe,t)},{event:t}),n.unprocessedBeforeInputData=null}],["click",function(t,e){is(e,()=>{const n=pr(),o=rl(Gi(e)),r=mr();if(o)if(jo(n)){const t=n.anchor,e=t.getNode();"element"===t.type&&0===t.offset&&n.isCollapsed()&&!gs(e)&&1===mi().getChildrenSize()&&e.getTopLevelElementOrThrow().isEmpty()&&null!==r&&n.is(r)&&(o.removeAllRanges(),n.dirty=!0)}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=gl(o,e._rootElement).anchorNode;if(Sl(n)||ti(n)){yi(_r(r,o,e,t))}}if(s&&null!==o&&0===o.rangeCount){const n=e._rootElement;if(null!==n&&t.target===n){const s=t.clientY;let i=n.childNodes.length;for(let t=0;t<n.childNodes.length;t++){const e=n.childNodes[t];if(Sl(e)){const n=e.getBoundingClientRect();if(s<=(n.top+n.bottom)/2){i=t;break}}}o.setBaseAndExtent(n,i,n,i);const l=_r(r,o,e,t);null!==l?yi(l):o.removeAllRanges()}}Bi(e,Ee,t)})}],["cut",Tn],["copy",Tn],["dragstart",Tn],["dragover",Tn],["dragend",Tn],["paste",Tn],["focus",Tn],["blur",Tn],["drop",Tn]];i&&Nn.push(["beforeinput",(t,e)=>function(t,e){const n=t.inputType;if("deleteCompositionText"===n||s&&Ki(e))return;if("insertCompositionText"===n)return;is(e,()=>{Rn(t,e)||Bi(e,ke,t)},{event:t})}(t,e)]);const vn=new WeakMap,En=new WeakMap,kn=Cn(t=>(t.addEventListener("selectionchange",Yn),()=>t.removeEventListener("selectionchange",Yn)));function On(t,e,n,o,r,s){const l=t.anchor,c=t.focus,a=l.getNode(),u=jr();let f;if(void 0!==s)f=s;else{const t=rl(Gi(u));f=null!==t?gl(t,u._rootElement):null}const d=null!==f?f.anchorNode:null,h=l.key,g=u.getElementByKey(h),_=n.length;return h!==c.key||!wo(a)||(!r&&(!i||u._inputState.lastBeforeInputInsertTextTimeStamp<o+50)||a.isDirty(
Line truncated
|
||||
+/*@__INLINE__*/function Te(t){return{type:t}}const Ne=/* @__PURE__ */Te("SELECTION_CHANGE_COMMAND"),ve=/* @__PURE__ */Te("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Ee=/* @__PURE__ */Te("CLICK_COMMAND"),ke=/* @__PURE__ */Te("BEFORE_INPUT_COMMAND"),Oe=/* @__PURE__ */Te("INPUT_COMMAND"),be=/* @__PURE__ */Te("COMPOSITION_START_COMMAND"),Me=/* @__PURE__ */Te("COMPOSITION_END_COMMAND"),Ae=/* @__PURE__ */Te("DELETE_CHARACTER_COMMAND"),De=/* @__PURE__ */Te("INSERT_LINE_BREAK_COMMAND"),we=/* @__PURE__ */Te("INSERT_PARAGRAPH_COMMAND"),Ie=/* @__PURE__ */Te("CONTROLLED_TEXT_INSERTION_COMMAND"),Pe=/* @__PURE__ */Te("PASTE_COMMAND"),Fe=/* @__PURE__ */Te("REMOVE_TEXT_COMMAND"),Re=/* @__PURE__ */Te("DELETE_WORD_COMMAND"),Le=/* @__PURE__ */Te("DELETE_LINE_COMMAND"),Ke=/* @__PURE__ */Te("FORMAT_TEXT_COMMAND"),Be=/* @__PURE__ */Te("SET_TEXT_FORMAT_COMMAND"),$e=/* @__PURE__ */Te("UNDO_COMMAND"),ze=/* @__PURE__ */Te("REDO_COMMAND"),We=/* @__PURE__ */Te("KEYDOWN_COMMAND"),Ue=/* @__PURE__ */Te("KEY_ARROW_RIGHT_COMMAND"),He=/* @__PURE__ */Te("MOVE_TO_END"),je=/* @__PURE__ */Te("KEY_ARROW_LEFT_COMMAND"),Ye=/* @__PURE__ */Te("MOVE_TO_START"),Ge=/* @__PURE__ */Te("KEY_ARROW_UP_COMMAND"),Je=/* @__PURE__ */Te("KEY_ARROW_DOWN_COMMAND"),Ve=/* @__PURE__ */Te("KEY_ENTER_COMMAND"),qe=/* @__PURE__ */Te("KEY_SPACE_COMMAND"),Xe=/* @__PURE__ */Te("KEY_BACKSPACE_COMMAND"),Qe=/* @__PURE__ */Te("KEY_ESCAPE_COMMAND"),Ze=/* @__PURE__ */Te("KEY_DELETE_COMMAND"),tn=/* @__PURE__ */Te("KEY_TAB_COMMAND"),en=/* @__PURE__ */Te("INSERT_TAB_COMMAND"),nn=/* @__PURE__ */Te("INDENT_CONTENT_COMMAND"),on=/* @__PURE__ */Te("OUTDENT_CONTENT_COMMAND"),rn=/* @__PURE__ */Te("DROP_COMMAND"),sn=/* @__PURE__ */Te("FORMAT_ELEMENT_COMMAND"),ln=/* @__PURE__ */Te("DRAGSTART_COMMAND"),cn=/* @__PURE__ */Te("DRAGOVER_COMMAND"),an=/* @__PURE__ */Te("DRAGEND_COMMAND"),un=/* @__PURE__ */Te("COPY_COMMAND"),fn=/* @__PURE__ */Te("CUT_COMMAND"),dn=/* @__PURE__ */Te("SELECT_ALL_COMMAND"),hn=/* @__PURE__ */Te("CLEAR_EDITOR_COMMAND"),gn=/* @__PURE__ */Te("CLEAR_HISTORY_COMMAND"),_n=/* @__PURE__ */Te("CAN_REDO_COMMAND"),pn=/* @__PURE__ */Te("CAN_UNDO_COMMAND"),mn=/* @__PURE__ */Te("FOCUS_COMMAND"),yn=/* @__PURE__ */Te("BLUR_COMMAND"),xn=/* @__PURE__ */Te("KEY_MODIFIER_COMMAND");function Cn(t){const e=new Map;return{dispose(){for(const t of e.values())t.dispose();e.clear()},register(n,o){let r=e.get(n);void 0===r&&(r={dispose:t(n,o),holders:new Set},e.set(n,r));const s=()=>{const t=e.get(n);t&&t.holders.delete(s)&&0===t.holders.size&&(e.delete(n),t.dispose())};return r.holders.add(s),s}}}function Sn(t,e,n,o){return t.addEventListener(e,n,o),t.removeEventListener.bind(t,e,n,o)}const Tn=Object.freeze({}),Nn=[["keydown",function(t,e){const n=e._inputState;n.lastKeyDownTimeStamp=t.timeStamp,n.lastKeyCode=t.key,"Backspace"!==t.key&&Pn(n);if(e.isComposing())return;Bi(e,We,t)}],["pointerdown",function(t,e){const n=Cl(t),o=t.pointerType;Tl(n)&&"touch"!==o&&"pen"!==o&&0===t.button&&is(e,()=>{Hl(n,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(t,e){Bi(e,be,t)}],["compositionend",function(t,e){const n=e._inputState;s?n.compositionPhase="ending-firefox":l||!a&&!d?Bi(e,Me,t):(n.compositionPhase="ending-safari",n.compositionEndData=t.data)}],["input",function(t,e){t.stopPropagation();const n=e._inputState;Pn(n),is(e,()=>{Rn(t,e)||e.dispatchCommand(Oe,t)},{event:t}),n.unprocessedBeforeInputData=null}],["click",function(t,e){is(e,()=>{const n=pr(),o=rl(Gi(e)),r=mr();if(o)if(jo(n)){const t=n.anchor,e=t.getNode();"element"===t.type&&0===t.offset&&n.isCollapsed()&&!gs(e)&&1===mi().getChildrenSize()&&e.getTopLevelElementOrThrow().isEmpty()&&null!==r&&n.is(r)&&(o.removeAllRanges(),n.dirty=!0)}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=gl(o,e._rootElement).anchorNode;if(Sl(n)||ti(n)){yi(_r(r,o,e,t))}}if(s&&null!==o&&0===o.rangeCount){const n=e._rootElement;if(null!==n&&t.target===n){const s=t.clientY;let i=n.childNodes.length;for(let t=0;t<n.childNodes.length;t++){const e=n.childNodes[t];if(Sl(e)){const n=e.getBoundingClientRect();if(s<=(n.top+n.bottom)/2){i=t;break}}}o.setBaseAndExtent(n,i,n,i);const l=_r(r,o,e,t);null!==l?yi(l):o.removeAllRanges()}}Bi(e,Ee,t)})}],["cut",Tn],["copy",Tn],["dragstart",Tn],["dragover",Tn],["dragend",Tn],["paste",Tn],["focus",Tn],["blur",Tn],["drop",Tn]];i&&Nn.push(["beforeinput",(t,e)=>function(t,e){const n=t.inputType;if("deleteCompositionText"===n||s&&Ki(e))return;if("insertCompositionText"===n)return;is(e,()=>{Rn(t,e)||Bi(e,ke,t)},{event:t})}(t,e)]);const vn=new WeakMap,En=new WeakMap,kn=Cn(t=>(t.addEventListener("selectionchange",Yn),()=>t.removeEventListener("selectionchange",Yn)));function On(t,e,n,o,r,s){const l=t.anchor,c=t.focus,a=l.getNode(),u=jr();let f;if(void 0!==s)f=s;else{const t=rl(Gi(u));f=null!==t?gl(t,u._rootElement):null}const d=null!==f?f.anchorNode:null,h=l.key,g=u.getElementByKey(h),_=n.length;return h!==c.key||!wo(a)||(!r&&(!i||u._inputState.lastBeforeInputInsertTextTimeStamp<o+50)||a.isDirty(
Line truncated
|
||||
diff --git a/dist/Lexical.prod.mjs b/dist/Lexical.prod.mjs
|
||||
index e2ef2d833f8403e4288764ee109759431c236481..38adb8318370c61ea67a32275227a863b6f68052 100644
|
||||
--- a/dist/Lexical.prod.mjs
|
||||
+++ b/dist/Lexical.prod.mjs
|
||||
@@ -9,2 +9,2 @@
|
||||
function t(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function e(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);n.search=o.toString(),console.warn(`Minified Lexical warning #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const n="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,o=n&&"documentMode"in document?document.documentMode:null,r=n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),i=n&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),s=!(!n||!("InputEvent"in window)||o)&&"getTargetRanges"in new window.InputEvent("input"),l=n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,c=n&&/Android/.test(navigator.userAgent),a=n&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent)&&!c,u=n&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f=n&&c&&u,d=n&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&r&&!u,h=0,g=1,_=2,p=1,y=2,m=4,x=8,C=16,S=32,v=64,T=128,k=2047,b=1,N=2,E=3,w=4,O=5,M=6,A=a||l||d?"\xa0":"\u200b",D="\n\n",F=i?"\xa0":A,P="\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc",I="A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff",L=new RegExp("^[^"+I+"]*["+P+"]"),K=new RegExp("^[^"+P+"]*["+I+"]"),z={bold:1,capitalize:1024,code:16,highlight:T,italic:2,lowercase:256,strikethrough:4,subscript:32,superscript:64,underline:8,uppercase:512},B={directionless:1,unmergeable:2},R={center:2,end:6,justify:4,left:1,right:3,start:5},W={[N]:"center",[M]:"end",[w]:"justify",[b]:"left",[E]:"right",[O]:"start"},$={normal:0,segmented:2,token:1},U={[h]:"normal",[_]:"segmented",[g]:"token"},H="$",j="$config";function J(){return vc()._blockCursorElement}function V(t){return null!==t&&1===t.nodeType&&t.hasAttribute("data-lexical-slot")}class q{element;before;after;constructor(t,e,n){this.element=t,this.before=e||null,this.after=n||null}withBefore(t){return new q(this.element,t,this.after)}withAfter(t){return new q(this.element,this.before,t)}withElement(t){return this.element===t?this:new q(t,this.before,this.after)}insertChild(e){const n=this.getInsertionAnchor();return null!==n&&n.parentElement!==this.element&&t(357),this.element.insertBefore(e,n),this}removeChild(e){return e.parentElement!==this.element&&t(358),this.element.removeChild(e),this}replaceChild(e,n){return n.parentElement!==this.element&&t(359),this.element.replaceChild(e,n),this}getFirstChild(){const t=this.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;return e===this.getInsertionAnchor()?null:e}getFirstChildAnchor(){return this.after}resolveLeafPosition(t,e,n){if(this.element===t)return e===t&&0===n?"before":"after";const o=Y(t,this.element);if(null===o)return"after";const r=Array.prototype.indexOf.call(t.childNodes,o);if(r<0)return"after";if(e===t)return n<=r?"before":"after";const i=Y(t,e);if(null===i)return"after";const s=Array.prototype.indexOf.call(t.childNodes,i);return s>=0&&s<=r?"before":"after"}getInsertionAnchor(){return this.before}}function Y(t,e){let n=e;for(;null!==n&&n.parentNode!==t;)n=n.parentNode;return n}class G extends q{withBefore(t){return new G(this.element,t,this.after)}withAfter(t){return new G(this.element,this.before,t)}withElement(t){return this.element===t?this:new G(t,this.before,this.after)}getInsertionAnchor(){return super.getInsertionAnchor()||this.getManagedLineBreak()}getFirstChildAnchor(){let t=super.getFirstChildAnchor(),e=t?t.nextSibling:this.element.firstChild;for(;V(e);)t=e,e=e.nextSibling;const n=t?t.nextSibling:this.element.firstChild;return null!==n&&n===J()?n:t}getManagedLineBreak(){return this.element.__lexicalLineBreak||null}setManagedLineBreak(t){if(this.element.__lexicalLastChildKind=t,null===t)this.removeManagedLineBreak();else{const e="decorator"===t&&(d||l||a);this.insertManagedLineBreak(e)}}removeManagedLineBreak(){const t=this.getManagedLineBreak();if(t){const e=this.element,n="IMG"===t.nodeName?t.nextSibling:null;n&&e.removeChild(n),e.removeChild(t),e.__lexicalLineBreak=void 0}}insertManagedLineBreak(t){const e=this.getManagedLineBreak();if(e){if(t===("IMG"===e.nodeName))return;this.removeManagedLineBreak()}const n=this.element,o=this.before,r=Zl().createElement("br");if(r.setAttribute("data-lexical-managed-linebreak","true"),n.insertBefore(r,o),t){const t=Zl().createElement("img");t.setAttribute("data-lexical-managed-linebreak","true"),t.style.setProperty("display","inline","important"),t.style.setProperty("border","0px","important"),t.style.setProperty("margin","0px","important"),t.alt="",n.insertBefore(t,r),n.__lexical
Line truncated
|
||||
-/*@__INLINE__*/function Pe(t){return{type:t}}const Ie=/* @__PURE__ */Pe("SELECTION_CHANGE_COMMAND"),Le=/* @__PURE__ */Pe("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Ke=/* @__PURE__ */Pe("CLICK_COMMAND"),ze=/* @__PURE__ */Pe("BEFORE_INPUT_COMMAND"),Be=/* @__PURE__ */Pe("INPUT_COMMAND"),Re=/* @__PURE__ */Pe("COMPOSITION_START_COMMAND"),We=/* @__PURE__ */Pe("COMPOSITION_END_COMMAND"),$e=/* @__PURE__ */Pe("DELETE_CHARACTER_COMMAND"),Ue=/* @__PURE__ */Pe("INSERT_LINE_BREAK_COMMAND"),He=/* @__PURE__ */Pe("INSERT_PARAGRAPH_COMMAND"),je=/* @__PURE__ */Pe("CONTROLLED_TEXT_INSERTION_COMMAND"),Je=/* @__PURE__ */Pe("PASTE_COMMAND"),Ve=/* @__PURE__ */Pe("REMOVE_TEXT_COMMAND"),qe=/* @__PURE__ */Pe("DELETE_WORD_COMMAND"),Ye=/* @__PURE__ */Pe("DELETE_LINE_COMMAND"),Ge=/* @__PURE__ */Pe("FORMAT_TEXT_COMMAND"),Xe=/* @__PURE__ */Pe("SET_TEXT_FORMAT_COMMAND"),Qe=/* @__PURE__ */Pe("UNDO_COMMAND"),Ze=/* @__PURE__ */Pe("REDO_COMMAND"),tn=/* @__PURE__ */Pe("KEYDOWN_COMMAND"),en=/* @__PURE__ */Pe("KEY_ARROW_RIGHT_COMMAND"),nn=/* @__PURE__ */Pe("MOVE_TO_END"),on=/* @__PURE__ */Pe("KEY_ARROW_LEFT_COMMAND"),rn=/* @__PURE__ */Pe("MOVE_TO_START"),sn=/* @__PURE__ */Pe("KEY_ARROW_UP_COMMAND"),ln=/* @__PURE__ */Pe("KEY_ARROW_DOWN_COMMAND"),cn=/* @__PURE__ */Pe("KEY_ENTER_COMMAND"),an=/* @__PURE__ */Pe("KEY_SPACE_COMMAND"),un=/* @__PURE__ */Pe("KEY_BACKSPACE_COMMAND"),fn=/* @__PURE__ */Pe("KEY_ESCAPE_COMMAND"),dn=/* @__PURE__ */Pe("KEY_DELETE_COMMAND"),hn=/* @__PURE__ */Pe("KEY_TAB_COMMAND"),gn=/* @__PURE__ */Pe("INSERT_TAB_COMMAND"),_n=/* @__PURE__ */Pe("INDENT_CONTENT_COMMAND"),pn=/* @__PURE__ */Pe("OUTDENT_CONTENT_COMMAND"),yn=/* @__PURE__ */Pe("DROP_COMMAND"),mn=/* @__PURE__ */Pe("FORMAT_ELEMENT_COMMAND"),xn=/* @__PURE__ */Pe("DRAGSTART_COMMAND"),Cn=/* @__PURE__ */Pe("DRAGOVER_COMMAND"),Sn=/* @__PURE__ */Pe("DRAGEND_COMMAND"),vn=/* @__PURE__ */Pe("COPY_COMMAND"),Tn=/* @__PURE__ */Pe("CUT_COMMAND"),kn=/* @__PURE__ */Pe("SELECT_ALL_COMMAND"),bn=/* @__PURE__ */Pe("CLEAR_EDITOR_COMMAND"),Nn=/* @__PURE__ */Pe("CLEAR_HISTORY_COMMAND"),En=/* @__PURE__ */Pe("CAN_REDO_COMMAND"),wn=/* @__PURE__ */Pe("CAN_UNDO_COMMAND"),On=/* @__PURE__ */Pe("FOCUS_COMMAND"),Mn=/* @__PURE__ */Pe("BLUR_COMMAND"),An=/* @__PURE__ */Pe("KEY_MODIFIER_COMMAND");function Dn(t){const e=new Map;return{dispose(){for(const t of e.values())t.dispose();e.clear()},register(n,o){let r=e.get(n);void 0===r&&(r={dispose:t(n,o),holders:new Set},e.set(n,r));const i=()=>{const t=e.get(n);t&&t.holders.delete(i)&&0===t.holders.size&&(e.delete(n),t.dispose())};return r.holders.add(i),i}}}function Fn(t,e,n,o){return t.addEventListener(e,n,o),t.removeEventListener.bind(t,e,n,o)}const Pn=Object.freeze({}),In=[["keydown",function(t,e){const n=e._inputState;n.lastKeyDownTimeStamp=t.timeStamp,n.lastKeyCode=t.key,"Backspace"!==t.key&&Jn(n);if(e.isComposing())return;Nl(e,tn,t)}],["pointerdown",function(t,e){const n=ac(t),o=t.pointerType;_c(n)&&"touch"!==o&&"pen"!==o&&0===t.button&&Ai(e,()=>{Rc(n,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(t,e){Nl(e,Re,t)}],["compositionend",function(t,e){const n=e._inputState;i?n.compositionPhase="ending-firefox":l||!a&&!d?Nl(e,We,t):(n.compositionPhase="ending-safari",n.compositionEndData=t.data)}],["input",function(t,e){t.stopPropagation();const n=e._inputState;Jn(n),Ai(e,()=>{qn(t,e)||e.dispatchCommand(Be,t)},{event:t}),n.unprocessedBeforeInputData=null}],["click",function(t,e){Ai(e,()=>{const n=Kr(),o=Jl(Il(e)),r=zr();if(o)if(ur(n)){const t=n.anchor,e=t.getNode();"element"===t.type&&0===t.offset&&n.isCollapsed()&&!Bi(e)&&1===nl().getChildrenSize()&&e.getTopLevelElementOrThrow().isEmpty()&&null!==r&&n.is(r)&&(o.removeAllRanges(),n.dirty=!0)}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=nc(o,e._rootElement).anchorNode;if(gc(n)||zs(n)){ol(Lr(r,o,e,t))}}if(i&&null!==o&&0===o.rangeCount){const n=e._rootElement;if(null!==n&&t.target===n){const i=t.clientY;let s=n.childNodes.length;for(let t=0;t<n.childNodes.length;t++){const e=n.childNodes[t];if(gc(e)){const n=e.getBoundingClientRect();if(i<=(n.top+n.bottom)/2){s=t;break}}}o.setBaseAndExtent(n,s,n,s);const l=Lr(r,o,e,t);null!==l?ol(l):o.removeAllRanges()}}Nl(e,Ke,t)})}],["cut",Pn],["copy",Pn],["dragstart",Pn],["dragover",Pn],["dragend",Pn],["paste",Pn],["focus",Pn],["blur",Pn],["drop",Pn]];s&&In.push(["beforeinput",(t,e)=>function(t,e){const n=t.inputType;if("deleteCompositionText"===n||i&&bl(e))return;if("insertCompositionText"===n)return;Ai(e,()=>{qn(t,e)||Nl(e,ze,t)},{event:t})}(t,e)]);const Ln=new WeakMap,Kn=new WeakMap,zn=Dn(t=>(t.addEventListener("selectionchange",ro),()=>t.removeEventListener("selectionchange",ro)));function Bn(t,e,n,o,r,i){const l=t.anchor,c=t.focus,a=l.getNode(),u=_i();let f;if(void 0!==i)f=i;else{const t=Jl(Il(u));f=null!==t?nc(t,u._rootElement):null}const d=null!==f?f.anchorNode:null,h=l.key,g=u.getElementByKey(h),_=n.length;return h!==c.key||!Xo(a)||(!r&&(!s||u._inputState.lastBeforeInputInsertTextTimeStamp<o+50)||a.isDirty(
Line truncated
|
||||
+/*@__INLINE__*/function Pe(t){return{type:t}}const Ie=/* @__PURE__ */Pe("SELECTION_CHANGE_COMMAND"),Le=/* @__PURE__ */Pe("SELECTION_INSERT_CLIPBOARD_NODES_COMMAND"),Ke=/* @__PURE__ */Pe("CLICK_COMMAND"),ze=/* @__PURE__ */Pe("BEFORE_INPUT_COMMAND"),Be=/* @__PURE__ */Pe("INPUT_COMMAND"),Re=/* @__PURE__ */Pe("COMPOSITION_START_COMMAND"),We=/* @__PURE__ */Pe("COMPOSITION_END_COMMAND"),$e=/* @__PURE__ */Pe("DELETE_CHARACTER_COMMAND"),Ue=/* @__PURE__ */Pe("INSERT_LINE_BREAK_COMMAND"),He=/* @__PURE__ */Pe("INSERT_PARAGRAPH_COMMAND"),je=/* @__PURE__ */Pe("CONTROLLED_TEXT_INSERTION_COMMAND"),Je=/* @__PURE__ */Pe("PASTE_COMMAND"),Ve=/* @__PURE__ */Pe("REMOVE_TEXT_COMMAND"),qe=/* @__PURE__ */Pe("DELETE_WORD_COMMAND"),Ye=/* @__PURE__ */Pe("DELETE_LINE_COMMAND"),Ge=/* @__PURE__ */Pe("FORMAT_TEXT_COMMAND"),Xe=/* @__PURE__ */Pe("SET_TEXT_FORMAT_COMMAND"),Qe=/* @__PURE__ */Pe("UNDO_COMMAND"),Ze=/* @__PURE__ */Pe("REDO_COMMAND"),tn=/* @__PURE__ */Pe("KEYDOWN_COMMAND"),en=/* @__PURE__ */Pe("KEY_ARROW_RIGHT_COMMAND"),nn=/* @__PURE__ */Pe("MOVE_TO_END"),on=/* @__PURE__ */Pe("KEY_ARROW_LEFT_COMMAND"),rn=/* @__PURE__ */Pe("MOVE_TO_START"),sn=/* @__PURE__ */Pe("KEY_ARROW_UP_COMMAND"),ln=/* @__PURE__ */Pe("KEY_ARROW_DOWN_COMMAND"),cn=/* @__PURE__ */Pe("KEY_ENTER_COMMAND"),an=/* @__PURE__ */Pe("KEY_SPACE_COMMAND"),un=/* @__PURE__ */Pe("KEY_BACKSPACE_COMMAND"),fn=/* @__PURE__ */Pe("KEY_ESCAPE_COMMAND"),dn=/* @__PURE__ */Pe("KEY_DELETE_COMMAND"),hn=/* @__PURE__ */Pe("KEY_TAB_COMMAND"),gn=/* @__PURE__ */Pe("INSERT_TAB_COMMAND"),_n=/* @__PURE__ */Pe("INDENT_CONTENT_COMMAND"),pn=/* @__PURE__ */Pe("OUTDENT_CONTENT_COMMAND"),yn=/* @__PURE__ */Pe("DROP_COMMAND"),mn=/* @__PURE__ */Pe("FORMAT_ELEMENT_COMMAND"),xn=/* @__PURE__ */Pe("DRAGSTART_COMMAND"),Cn=/* @__PURE__ */Pe("DRAGOVER_COMMAND"),Sn=/* @__PURE__ */Pe("DRAGEND_COMMAND"),vn=/* @__PURE__ */Pe("COPY_COMMAND"),Tn=/* @__PURE__ */Pe("CUT_COMMAND"),kn=/* @__PURE__ */Pe("SELECT_ALL_COMMAND"),bn=/* @__PURE__ */Pe("CLEAR_EDITOR_COMMAND"),Nn=/* @__PURE__ */Pe("CLEAR_HISTORY_COMMAND"),En=/* @__PURE__ */Pe("CAN_REDO_COMMAND"),wn=/* @__PURE__ */Pe("CAN_UNDO_COMMAND"),On=/* @__PURE__ */Pe("FOCUS_COMMAND"),Mn=/* @__PURE__ */Pe("BLUR_COMMAND"),An=/* @__PURE__ */Pe("KEY_MODIFIER_COMMAND");function Dn(t){const e=new Map;return{dispose(){for(const t of e.values())t.dispose();e.clear()},register(n,o){let r=e.get(n);void 0===r&&(r={dispose:t(n,o),holders:new Set},e.set(n,r));const i=()=>{const t=e.get(n);t&&t.holders.delete(i)&&0===t.holders.size&&(e.delete(n),t.dispose())};return r.holders.add(i),i}}}function Fn(t,e,n,o){return t.addEventListener(e,n,o),t.removeEventListener.bind(t,e,n,o)}const Pn=Object.freeze({}),In=[["keydown",function(t,e){const n=e._inputState;n.lastKeyDownTimeStamp=t.timeStamp,n.lastKeyCode=t.key,"Backspace"!==t.key&&Jn(n);if(e.isComposing())return;Nl(e,tn,t)}],["pointerdown",function(t,e){const n=ac(t),o=t.pointerType;_c(n)&&"touch"!==o&&"pen"!==o&&0===t.button&&Ai(e,()=>{Rc(n,e)||(e._inputState.isSelectionChangeFromMouseDown=!0)})}],["compositionstart",function(t,e){Nl(e,Re,t)}],["compositionend",function(t,e){const n=e._inputState;i?n.compositionPhase="ending-firefox":l||!a&&!d?Nl(e,We,t):(n.compositionPhase="ending-safari",n.compositionEndData=t.data)}],["input",function(t,e){t.stopPropagation();const n=e._inputState;Jn(n),Ai(e,()=>{qn(t,e)||e.dispatchCommand(Be,t)},{event:t}),n.unprocessedBeforeInputData=null}],["click",function(t,e){Ai(e,()=>{const n=Kr(),o=Jl(Il(e)),r=zr();if(o)if(ur(n)){const t=n.anchor,e=t.getNode();"element"===t.type&&0===t.offset&&n.isCollapsed()&&!Bi(e)&&1===nl().getChildrenSize()&&e.getTopLevelElementOrThrow().isEmpty()&&null!==r&&n.is(r)&&(o.removeAllRanges(),n.dirty=!0)}else if("touch"===t.pointerType||"pen"===t.pointerType){const n=nc(o,e._rootElement).anchorNode;if(gc(n)||zs(n)){ol(Lr(r,o,e,t))}}if(i&&null!==o&&0===o.rangeCount){const n=e._rootElement;if(null!==n&&t.target===n){const i=t.clientY;let s=n.childNodes.length;for(let t=0;t<n.childNodes.length;t++){const e=n.childNodes[t];if(gc(e)){const n=e.getBoundingClientRect();if(i<=(n.top+n.bottom)/2){s=t;break}}}o.setBaseAndExtent(n,s,n,s);const l=Lr(r,o,e,t);null!==l?ol(l):o.removeAllRanges()}}Nl(e,Ke,t)})}],["cut",Pn],["copy",Pn],["dragstart",Pn],["dragover",Pn],["dragend",Pn],["paste",Pn],["focus",Pn],["blur",Pn],["drop",Pn]];s&&In.push(["beforeinput",(t,e)=>function(t,e){const n=t.inputType;if("deleteCompositionText"===n||i&&bl(e))return;if("insertCompositionText"===n)return;Ai(e,()=>{qn(t,e)||Nl(e,ze,t)},{event:t})}(t,e)]);const Ln=new WeakMap,Kn=new WeakMap,zn=Dn(t=>(t.addEventListener("selectionchange",ro),()=>t.removeEventListener("selectionchange",ro)));function Bn(t,e,n,o,r,i){const l=t.anchor,c=t.focus,a=l.getNode(),u=_i();let f;if(void 0!==i)f=i;else{const t=Jl(Il(u));f=null!==t?nc(t,u._rootElement):null}const d=null!==f?f.anchorNode:null,h=l.key,g=u.getElementByKey(h),_=n.length;return h!==c.key||!Xo(a)||(!r&&(!s||u._inputState.lastBeforeInputInsertTextTimeStamp<o+50)||a.isDirty(
Line truncated
|
||||
diff --git a/src/LexicalUtils.ts b/src/LexicalUtils.ts
|
||||
index 68509f1a85808d87999aa52183157258e39f97a1..661334b9d5ae3f67d25cef64527939db2e16e706 100644
|
||||
--- a/src/LexicalUtils.ts
|
||||
+++ b/src/LexicalUtils.ts
|
||||
@@ -1638,7 +1638,8 @@ export function scrollIntoViewIfNeeded(
|
||||
// or the caret stays behind the keyboard.
|
||||
const visualViewport = defaultView.visualViewport;
|
||||
if (visualViewport) {
|
||||
- const offsetTop = visualViewport.offsetTop;
|
||||
+ // Match getBoundingClientRect coordinates when a keyboard pans the page.
|
||||
+ const offsetTop = visualViewport.pageTop - defaultView.scrollY;
|
||||
targetTop = offsetTop;
|
||||
targetBottom = offsetTop + visualViewport.height;
|
||||
} else {
|
||||
Generated
+14
-13
@@ -18,6 +18,7 @@ patchedDependencies:
|
||||
'@yao-pkg/pkg@6.21.0': 4d4861969595629311f7d90a0b34b15481c96d5682d828a151a104c69d4616d3
|
||||
app-builder-lib@26.17.0: b70dc2a2a78ffabb80a4f14fafc7c103237f2b0a207e1f296fa1c1387ea29348
|
||||
exceljs@4.4.0: c1bf8ac8f319dab382f08e3a669b715e691d46c703ac5a4163eb383fbedd1d48
|
||||
lexical@0.49.0: 54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356
|
||||
node-pty@1.2.0-beta.15: 9d30053266d0f39d3debe894c675867f6782da6bcadbc94a693b3cfb9eff8ed0
|
||||
|
||||
importers:
|
||||
@@ -3993,7 +3994,7 @@ importers:
|
||||
version: 2.1.1
|
||||
lexical:
|
||||
specifier: ^0.49.0
|
||||
version: 0.49.0(typescript@6.0.3)
|
||||
version: 0.49.0(patch_hash=54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356)(typescript@6.0.3)
|
||||
react:
|
||||
specifier: ^18.2.0
|
||||
version: 18.3.1
|
||||
@@ -25690,14 +25691,14 @@ snapshots:
|
||||
'@lexical/selection': 0.49.0(typescript@6.0.3)
|
||||
'@lexical/utils': 0.49.0(typescript@6.0.3)
|
||||
'@types/trusted-types': 2.0.7
|
||||
lexical: 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(patch_hash=54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356)(typescript@6.0.3)
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
'@lexical/dragon@0.49.0(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@lexical/extension': 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(patch_hash=54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356)(typescript@6.0.3)
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
@@ -25706,7 +25707,7 @@ snapshots:
|
||||
'@lexical/internal': 0.49.0(typescript@6.0.3)
|
||||
'@lexical/utils': 0.49.0(typescript@6.0.3)
|
||||
'@preact/signals-core': 1.14.4
|
||||
lexical: 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(patch_hash=54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356)(typescript@6.0.3)
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
@@ -25714,7 +25715,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@lexical/internal': 0.49.0(typescript@6.0.3)
|
||||
happy-dom: 20.11.6
|
||||
lexical: 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(patch_hash=54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356)(typescript@6.0.3)
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
transitivePeerDependencies:
|
||||
@@ -25725,7 +25726,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@lexical/extension': 0.49.0(typescript@6.0.3)
|
||||
'@lexical/utils': 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(patch_hash=54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356)(typescript@6.0.3)
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
@@ -25735,7 +25736,7 @@ snapshots:
|
||||
'@lexical/internal': 0.49.0(typescript@6.0.3)
|
||||
'@lexical/selection': 0.49.0(typescript@6.0.3)
|
||||
'@lexical/utils': 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(patch_hash=54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356)(typescript@6.0.3)
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
@@ -25749,7 +25750,7 @@ snapshots:
|
||||
'@lexical/html': 0.49.0(typescript@6.0.3)
|
||||
'@lexical/internal': 0.49.0(typescript@6.0.3)
|
||||
'@lexical/utils': 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(patch_hash=54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356)(typescript@6.0.3)
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
@@ -25760,21 +25761,21 @@ snapshots:
|
||||
'@lexical/extension': 0.49.0(typescript@6.0.3)
|
||||
'@lexical/selection': 0.49.0(typescript@6.0.3)
|
||||
'@lexical/utils': 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(patch_hash=54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356)(typescript@6.0.3)
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
'@lexical/selection@0.49.0(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@lexical/internal': 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(patch_hash=54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356)(typescript@6.0.3)
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
'@lexical/text@0.49.0(typescript@6.0.3)':
|
||||
dependencies:
|
||||
'@lexical/internal': 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(patch_hash=54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356)(typescript@6.0.3)
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
@@ -25782,7 +25783,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@lexical/internal': 0.49.0(typescript@6.0.3)
|
||||
'@lexical/selection': 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(typescript@6.0.3)
|
||||
lexical: 0.49.0(patch_hash=54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356)(typescript@6.0.3)
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
@@ -29646,7 +29647,7 @@ snapshots:
|
||||
prelude-ls: 1.2.1
|
||||
type-check: 0.4.0
|
||||
|
||||
lexical@0.49.0(typescript@6.0.3):
|
||||
lexical@0.49.0(patch_hash=54c4413db208cf234cb68c6a837f2523d3b319aa17911f1da385af08362e1356)(typescript@6.0.3):
|
||||
dependencies:
|
||||
'@lexical/internal': 0.49.0(typescript@6.0.3)
|
||||
optionalDependencies:
|
||||
|
||||
@@ -116,4 +116,5 @@ patchedDependencies:
|
||||
'@yao-pkg/pkg@6.21.0': patches/@yao-pkg__pkg@6.21.0.patch
|
||||
app-builder-lib@26.17.0: patches/app-builder-lib@26.17.0.patch
|
||||
exceljs@4.4.0: patches/exceljs@4.4.0.patch
|
||||
lexical@0.49.0: patches/lexical@0.49.0.patch
|
||||
node-pty@1.2.0-beta.15: patches/node-pty@1.2.0-beta.15.patch
|
||||
Reference in new issue
Block a user