@blocksuite/store
Advanced tools
Comparing version 0.5.0-20230324145140-41b55b4 to 0.5.0-20230325162440-97027e3
@@ -13,27 +13,2 @@ import type { BaseTextAttributes } from '@blocksuite/virgo'; | ||
} & OptionalAttributes; | ||
declare module 'yjs' { | ||
interface Text { | ||
/** | ||
* Specific addition used by @blocksuite/store | ||
* When set, we know it hasn't been applied to virgo. | ||
* When specified, we call this a "controlled operation". | ||
* | ||
* Consider renaming this to closer indicate this is simply a "controlled operation", | ||
* since we may not actually use this information. | ||
*/ | ||
meta?: { | ||
split: true; | ||
} | { | ||
join: true; | ||
} | { | ||
format: true; | ||
} | { | ||
delete: true; | ||
} | { | ||
clear: true; | ||
} | { | ||
replace: true; | ||
}; | ||
} | ||
} | ||
export declare class Text { | ||
@@ -45,3 +20,3 @@ private _yText; | ||
get length(): number; | ||
get yText(): Y.YText; | ||
get yText(): Y.Text; | ||
private _transact; | ||
@@ -48,0 +23,0 @@ clone(): Text; |
@@ -112,3 +112,2 @@ import * as Y from 'yjs'; | ||
this._yText.insert(index, content, attributes); | ||
this._yText.meta = { split: true }; | ||
}); | ||
@@ -129,3 +128,2 @@ } | ||
} | ||
this._yText.meta = { split: true }; | ||
}); | ||
@@ -142,3 +140,2 @@ } | ||
this._yText.applyDelta(delta); | ||
this._yText.meta = { join: true }; | ||
}); | ||
@@ -160,3 +157,2 @@ } | ||
this._yText.format(index, length, format); | ||
this._yText.meta = { format: true }; | ||
}); | ||
@@ -178,3 +174,2 @@ } | ||
this._yText.delete(index, length); | ||
this._yText.meta = { delete: true }; | ||
}); | ||
@@ -195,3 +190,2 @@ } | ||
this._yText.insert(index, content, attributes); | ||
this._yText.meta = { replace: true }; | ||
}); | ||
@@ -205,3 +199,2 @@ } | ||
this._yText.delete(0, this._yText.length); | ||
this._yText.meta = { clear: true }; | ||
}); | ||
@@ -208,0 +201,0 @@ } |
@@ -70,3 +70,3 @@ /// <reference types="@blocksuite/global" /> | ||
get canRedo(): boolean; | ||
get YText(): typeof Y.YText; | ||
get YText(): typeof Y.Text; | ||
get Text(): typeof Text; | ||
@@ -73,0 +73,0 @@ undo: () => void; |
{ | ||
"name": "@blocksuite/store", | ||
"version": "0.5.0-20230324145140-41b55b4", | ||
"version": "0.5.0-20230325162440-97027e3", | ||
"description": "BlockSuite data store built for general purpose state management.", | ||
@@ -11,4 +11,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@blocksuite/global": "0.5.0-20230324145140-41b55b4", | ||
"@blocksuite/virgo": "0.5.0-20230324145140-41b55b4", | ||
"@blocksuite/global": "0.5.0-20230325162440-97027e3", | ||
"@blocksuite/virgo": "0.5.0-20230325162440-97027e3", | ||
"@types/flexsearch": "^0.7.3", | ||
@@ -15,0 +15,0 @@ "buffer": "^6.0.3", |
@@ -16,22 +16,2 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ | ||
declare module 'yjs' { | ||
interface Text { | ||
/** | ||
* Specific addition used by @blocksuite/store | ||
* When set, we know it hasn't been applied to virgo. | ||
* When specified, we call this a "controlled operation". | ||
* | ||
* Consider renaming this to closer indicate this is simply a "controlled operation", | ||
* since we may not actually use this information. | ||
*/ | ||
meta?: | ||
| { split: true } | ||
| { join: true } | ||
| { format: true } | ||
| { delete: true } | ||
| { clear: true } | ||
| { replace: true }; | ||
} | ||
} | ||
export class Text { | ||
@@ -165,3 +145,2 @@ private _yText: Y.Text; | ||
this._yText.insert(index, content, attributes); | ||
this._yText.meta = { split: true }; | ||
}); | ||
@@ -186,3 +165,2 @@ } | ||
} | ||
this._yText.meta = { split: true }; | ||
}); | ||
@@ -200,3 +178,2 @@ } | ||
this._yText.applyDelta(delta); | ||
this._yText.meta = { join: true }; | ||
}); | ||
@@ -221,3 +198,2 @@ } | ||
this._yText.format(index, length, format); | ||
this._yText.meta = { format: true }; | ||
}); | ||
@@ -242,3 +218,2 @@ } | ||
this._yText.delete(index, length); | ||
this._yText.meta = { delete: true }; | ||
}); | ||
@@ -267,3 +242,2 @@ } | ||
this._yText.insert(index, content, attributes); | ||
this._yText.meta = { replace: true }; | ||
}); | ||
@@ -278,3 +252,2 @@ } | ||
this._yText.delete(0, this._yText.length); | ||
this._yText.meta = { clear: true }; | ||
}); | ||
@@ -281,0 +254,0 @@ } |
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
Sorry, the diff of this file is not supported yet
581012
8589
+ Added@blocksuite/global@0.5.0-20230325162440-97027e3(transitive)
+ Added@blocksuite/virgo@0.5.0-20230325162440-97027e3(transitive)
- Removed@blocksuite/global@0.5.0-20230324145140-41b55b4(transitive)
- Removed@blocksuite/virgo@0.5.0-20230324145140-41b55b4(transitive)