@blocksuite/store
Advanced tools
Comparing version 0.5.0-20230305195734-5878b62 to 0.5.0-20230306231625-c219ab3
@@ -50,2 +50,3 @@ /// <reference types="@blocksuite/global" /> | ||
constructor(workspace: Workspace, id: string, doc: BlockSuiteDoc, awarenessStore: AwarenessStore, idGenerator?: IdGenerator); | ||
get readonly(): boolean; | ||
get history(): Y.UndoManager; | ||
@@ -52,0 +53,0 @@ get workspace(): Workspace; |
@@ -39,3 +39,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
this.undo = () => { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -47,3 +47,3 @@ return; | ||
this.redo = () => { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -100,2 +100,5 @@ return; | ||
} | ||
get readonly() { | ||
return this.awarenessStore.isReadonly(this); | ||
} | ||
get history() { | ||
@@ -153,3 +156,3 @@ return this._history; | ||
get canUndo() { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
return false; | ||
@@ -160,3 +163,3 @@ } | ||
get canRedo() { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
return false; | ||
@@ -298,3 +301,3 @@ } | ||
addBlockByFlavour(flavour, blockProps = {}, parent, parentIndex) { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
throw new Error('cannot modify data in readonly mode'); | ||
@@ -347,3 +350,3 @@ } | ||
updateBlockById(id, props) { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -356,3 +359,3 @@ return; | ||
moveBlocks(blocks, targetModel, top = true) { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -393,3 +396,3 @@ return; | ||
updateBlock(model, props) { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -442,3 +445,3 @@ return; | ||
deleteBlockById(id) { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -453,3 +456,3 @@ return; | ||
}) { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -456,0 +459,0 @@ return; |
{ | ||
"name": "@blocksuite/store", | ||
"version": "0.5.0-20230305195734-5878b62", | ||
"version": "0.5.0-20230306231625-c219ab3", | ||
"description": "BlockSuite data store built for general purpose state management.", | ||
@@ -11,4 +11,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@blocksuite/global": "0.5.0-20230305195734-5878b62", | ||
"@blocksuite/virgo": "0.5.0-20230305195734-5878b62", | ||
"@blocksuite/global": "0.5.0-20230306231625-c219ab3", | ||
"@blocksuite/virgo": "0.5.0-20230306231625-c219ab3", | ||
"@types/flexsearch": "^0.7.3", | ||
@@ -15,0 +15,0 @@ "buffer": "^6.0.3", |
@@ -89,2 +89,6 @@ import type { BlockTag, TagSchema } from '@blocksuite/global/database'; | ||
get readonly() { | ||
return this.awarenessStore.isReadonly(this); | ||
} | ||
get history() { | ||
@@ -152,3 +156,3 @@ return this._history; | ||
get canUndo() { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
return false; | ||
@@ -160,3 +164,3 @@ } | ||
get canRedo() { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
return false; | ||
@@ -176,3 +180,3 @@ } | ||
undo = () => { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -185,3 +189,3 @@ return; | ||
redo = () => { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -391,3 +395,3 @@ return; | ||
): string { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
throw new Error('cannot modify data in readonly mode'); | ||
@@ -467,3 +471,3 @@ } | ||
updateBlockById(id: string, props: Partial<BlockProps>) { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -482,3 +486,3 @@ return; | ||
) { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -525,3 +529,3 @@ return; | ||
updateBlock<T extends Partial<BlockProps>>(model: BaseBlockModel, props: T) { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -601,3 +605,3 @@ return; | ||
deleteBlockById(id: string) { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -619,3 +623,3 @@ return; | ||
) { | ||
if (this.awarenessStore.isReadonly(this)) { | ||
if (this.readonly) { | ||
console.error('cannot modify data in readonly mode'); | ||
@@ -622,0 +626,0 @@ return; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
577569
3080
8687
31
7
63
+ Added@blocksuite/global@0.5.0-20230306231625-c219ab3(transitive)
+ Added@blocksuite/virgo@0.5.0-20230306231625-c219ab3(transitive)
- Removed@blocksuite/global@0.5.0-20230305195734-5878b62(transitive)
- Removed@blocksuite/virgo@0.5.0-20230305195734-5878b62(transitive)