@blocksuite/inline
Advanced tools
Comparing version 0.14.0-canary-202403250855-4171ecd to 0.14.0-canary-202403251109-adfe20e
@@ -108,3 +108,3 @@ import { DisposableGroup, Slot } from '@blocksuite/global/utils'; | ||
}); | ||
mount(rootElement: HTMLElement, eventSource?: HTMLElement): void; | ||
mount(rootElement: HTMLElement, eventSource?: HTMLElement, isReadonly?: boolean): void; | ||
unmount(): void; | ||
@@ -111,0 +111,0 @@ requestUpdate(syncInlineRange?: boolean): void; |
@@ -177,3 +177,3 @@ import { assertExists, DisposableGroup, Slot } from '@blocksuite/global/utils'; | ||
} | ||
mount(rootElement, eventSource = rootElement) { | ||
mount(rootElement, eventSource = rootElement, isReadonly = false) { | ||
const inlineRoot = rootElement; | ||
@@ -183,8 +183,6 @@ inlineRoot.inlineEditor = this; | ||
this._eventSource = eventSource; | ||
render(nothing, this._rootElement); | ||
this._rootElement.contentEditable = 'true'; | ||
this._rootElement.style.outline = 'none'; | ||
this._eventSource.contentEditable = 'true'; | ||
this._eventSource.style.outline = 'none'; | ||
this._rootElement.dataset.vRoot = 'true'; | ||
this.setReadonly(isReadonly); | ||
render(nothing, this._rootElement); | ||
this._bindYTextObserver(); | ||
@@ -214,4 +212,5 @@ this._eventService.mount(); | ||
setReadonly(isReadonly) { | ||
this.rootElement.contentEditable = isReadonly ? 'false' : 'true'; | ||
this.eventSource.contentEditable = isReadonly ? 'false' : 'true'; | ||
const value = isReadonly ? 'false' : 'true'; | ||
this.rootElement.contentEditable = value; | ||
this.eventSource.contentEditable = value; | ||
this._isReadonly = isReadonly; | ||
@@ -218,0 +217,0 @@ } |
{ | ||
"name": "@blocksuite/inline", | ||
"version": "0.14.0-canary-202403250855-4171ecd", | ||
"version": "0.14.0-canary-202403251109-adfe20e", | ||
"description": "A micro editor.", | ||
@@ -33,3 +33,3 @@ "type": "module", | ||
"zod": "^3.22.4", | ||
"@blocksuite/global": "0.14.0-canary-202403250855-4171ecd" | ||
"@blocksuite/global": "0.14.0-canary-202403251109-adfe20e" | ||
}, | ||
@@ -36,0 +36,0 @@ "scripts": { |
@@ -230,3 +230,7 @@ import { assertExists, DisposableGroup, Slot } from '@blocksuite/global/utils'; | ||
mount(rootElement: HTMLElement, eventSource: HTMLElement = rootElement) { | ||
mount( | ||
rootElement: HTMLElement, | ||
eventSource: HTMLElement = rootElement, | ||
isReadonly = false | ||
) { | ||
const inlineRoot = rootElement as InlineRootElement<TextAttributes>; | ||
@@ -236,8 +240,6 @@ inlineRoot.inlineEditor = this; | ||
this._eventSource = eventSource; | ||
render(nothing, this._rootElement); | ||
this._rootElement.contentEditable = 'true'; | ||
this._rootElement.style.outline = 'none'; | ||
this._eventSource.contentEditable = 'true'; | ||
this._eventSource.style.outline = 'none'; | ||
this._rootElement.dataset.vRoot = 'true'; | ||
this.setReadonly(isReadonly); | ||
render(nothing, this._rootElement); | ||
@@ -274,4 +276,5 @@ this._bindYTextObserver(); | ||
setReadonly(isReadonly: boolean): void { | ||
this.rootElement.contentEditable = isReadonly ? 'false' : 'true'; | ||
this.eventSource.contentEditable = isReadonly ? 'false' : 'true'; | ||
const value = isReadonly ? 'false' : 'true'; | ||
this.rootElement.contentEditable = value; | ||
this.eventSource.contentEditable = value; | ||
this._isReadonly = isReadonly; | ||
@@ -278,0 +281,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
5369
400697
+ Added@blocksuite/global@0.14.0-canary-202403251109-adfe20e(transitive)
- Removed@blocksuite/global@0.14.0-canary-202403250855-4171ecd(transitive)
Updated@blocksuite/global@0.14.0-canary-202403251109-adfe20e