@blocksuite/store
Advanced tools
Comparing version 0.4.0-20230125204655-410ba23 to 0.4.0-20230126161407-c60bfba
@@ -5,3 +5,2 @@ /// <reference types="@blocksuite/global" /> | ||
import { Signal } from '@blocksuite/global/utils'; | ||
import type { DeltaOperation } from 'quill'; | ||
import type * as Y from 'yjs'; | ||
@@ -32,5 +31,2 @@ interface StaticValue { | ||
lastChild(): BaseBlockModel | null; | ||
block2html(childText: string, _previousSiblingId: string, _nextSiblingId: string, begin?: number, end?: number): string; | ||
block2Text(childText: string, begin?: number, end?: number): string; | ||
_deltaLeaf2Html(deltaLeaf: DeltaOperation): string; | ||
dispose(): void; | ||
@@ -37,0 +33,0 @@ } |
@@ -24,39 +24,2 @@ import { Signal } from '@blocksuite/global/utils'; | ||
} | ||
block2html(childText, _previousSiblingId, _nextSiblingId, begin, end) { | ||
const delta = this.text?.sliceToDelta(begin || 0, end) || []; | ||
const text = delta.reduce((html, item) => { | ||
return html + this._deltaLeaf2Html(item); | ||
}, ''); | ||
return `${text}${childText}`; | ||
} | ||
block2Text(childText, begin, end) { | ||
const text = (this.text?.toString() || '').slice(begin || 0, end); | ||
return `${text}${childText}`; | ||
} | ||
_deltaLeaf2Html(deltaLeaf) { | ||
let text = deltaLeaf.insert; | ||
const attributes = deltaLeaf.attributes; | ||
if (!attributes) { | ||
return text; | ||
} | ||
if (attributes.code) { | ||
text = `<code>${text}</code>`; | ||
} | ||
if (attributes.bold) { | ||
text = `<strong>${text}</strong>`; | ||
} | ||
if (attributes.italic) { | ||
text = `<em>${text}</em>`; | ||
} | ||
if (attributes.underline) { | ||
text = `<u>${text}</u>`; | ||
} | ||
if (attributes.strikethrough) { | ||
text = `<s>${text}</s>`; | ||
} | ||
if (attributes.link) { | ||
text = `<a href='${attributes.link}'>${text}</a>`; | ||
} | ||
return text; | ||
} | ||
dispose() { | ||
@@ -63,0 +26,0 @@ this.propsUpdated.dispose(); |
{ | ||
"name": "@blocksuite/store", | ||
"version": "0.4.0-20230125204655-410ba23", | ||
"version": "0.4.0-20230126161407-c60bfba", | ||
"description": "BlockSuite data store built for general purpose state management.", | ||
@@ -11,3 +11,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@blocksuite/global": "0.4.0-20230125204655-410ba23", | ||
"@blocksuite/global": "0.4.0-20230126161407-c60bfba", | ||
"@types/flexsearch": "^0.7.3", | ||
@@ -14,0 +14,0 @@ "buffer": "^6.0.3", |
import type { Page } from './workspace/index.js'; | ||
import type { TextType } from './text-adapter.js'; | ||
import { Signal } from '@blocksuite/global/utils'; | ||
import type { DeltaOperation } from 'quill'; | ||
import type * as Y from 'yjs'; | ||
@@ -61,48 +60,2 @@ | ||
block2html( | ||
childText: string, | ||
_previousSiblingId: string, | ||
_nextSiblingId: string, | ||
begin?: number, | ||
end?: number | ||
) { | ||
const delta = this.text?.sliceToDelta(begin || 0, end) || []; | ||
const text = delta.reduce((html: string, item: DeltaOperation) => { | ||
return html + this._deltaLeaf2Html(item); | ||
}, ''); | ||
return `${text}${childText}`; | ||
} | ||
block2Text(childText: string, begin?: number, end?: number) { | ||
const text = (this.text?.toString() || '').slice(begin || 0, end); | ||
return `${text}${childText}`; | ||
} | ||
_deltaLeaf2Html(deltaLeaf: DeltaOperation) { | ||
let text: string = deltaLeaf.insert; | ||
const attributes = deltaLeaf.attributes; | ||
if (!attributes) { | ||
return text; | ||
} | ||
if (attributes.code) { | ||
text = `<code>${text}</code>`; | ||
} | ||
if (attributes.bold) { | ||
text = `<strong>${text}</strong>`; | ||
} | ||
if (attributes.italic) { | ||
text = `<em>${text}</em>`; | ||
} | ||
if (attributes.underline) { | ||
text = `<u>${text}</u>`; | ||
} | ||
if (attributes.strikethrough) { | ||
text = `<s>${text}</s>`; | ||
} | ||
if (attributes.link) { | ||
text = `<a href='${attributes.link}'>${text}</a>`; | ||
} | ||
return text; | ||
} | ||
dispose() { | ||
@@ -109,0 +62,0 @@ this.propsUpdated.dispose(); |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
494574
8095
+ Added@blocksuite/global@0.4.0-20230126161407-c60bfba(transitive)
- Removed@blocksuite/global@0.4.0-20230125204655-410ba23(transitive)