Don't allow users to change the readonly via the editor api.

pull/3534/head^2
Mitja Bezenšek 2024-04-22 15:01:59 +02:00
rodzic 0e14c0e01e
commit 4709274b2b
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -1182,7 +1182,12 @@ export class Editor extends EventEmitter<TLEventMap> {
partial: Partial<Omit<TLInstance, 'currentPageId'>>,
historyOptions?: TLCommandHistoryOptions
): this {
this._updateInstanceState(partial, { ephemeral: true, squashing: true, ...historyOptions })
if (partial.isReadonly === false && this.getInstanceState().isReadonly === true) {
const { isReadonly: _isReadonly, ...rest } = partial
this._updateInstanceState(rest, { ephemeral: true, squashing: true, ...historyOptions })
} else {
this._updateInstanceState(partial, { ephemeral: true, squashing: true, ...historyOptions })
}
if (partial.isChangingStyle !== undefined) {
clearTimeout(this._isChangingStyleTimeout)