@blocksuite/inline
Advanced tools
Comparing version 0.0.0-canary-20241113001418 to 0.0.0-canary-20241114001404
# @blocksuite/inline | ||
## 0.0.0-canary-20241113001418 | ||
## 0.0.0-canary-20241114001404 | ||
@@ -9,4 +9,35 @@ ### Patch Changes | ||
- Updated dependencies | ||
- @blocksuite/global@0.0.0-canary-20241113001418 | ||
- @blocksuite/global@0.0.0-canary-20241114001404 | ||
## 0.17.32 | ||
### Patch Changes | ||
- 7bc83ab: ## Fix | ||
- fix: mind map text layout (#8737) | ||
- Updated dependencies [7bc83ab] | ||
- @blocksuite/global@0.17.32 | ||
## 0.17.31 | ||
### Patch Changes | ||
- 8ab2800: patch more fix | ||
## Fix | ||
- fix(database): lock the group while editing (#8741) | ||
- fix(inline): double click in empty line (#8740) | ||
- fix(inline): triple click in v-line (#8739) | ||
- fix(database): root block might not exist in AFFiNE (#8738) | ||
## Refactor | ||
- refactor: mind map drag (#8716) | ||
- Updated dependencies [8ab2800] | ||
- @blocksuite/global@0.17.31 | ||
## 0.17.30 | ||
@@ -13,0 +44,0 @@ |
@@ -29,3 +29,5 @@ import { LitElement, type TemplateResult } from 'lit'; | ||
accessor elements: [TemplateResult<1>, DeltaInsert][]; | ||
accessor endOffset: number; | ||
accessor index: number; | ||
accessor startOffset: number; | ||
} | ||
@@ -32,0 +34,0 @@ declare global { |
@@ -47,5 +47,11 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { | ||
let _elements_extraInitializers = []; | ||
let _endOffset_decorators; | ||
let _endOffset_initializers = []; | ||
let _endOffset_extraInitializers = []; | ||
let _index_decorators; | ||
let _index_initializers = []; | ||
let _index_extraInitializers = []; | ||
let _startOffset_decorators; | ||
let _startOffset_initializers = []; | ||
let _startOffset_extraInitializers = []; | ||
return class VLine extends _classSuper { | ||
@@ -55,5 +61,9 @@ static { | ||
_elements_decorators = [property({ attribute: false })]; | ||
_endOffset_decorators = [property({ attribute: false })]; | ||
_index_decorators = [property({ attribute: false })]; | ||
_startOffset_decorators = [property({ attribute: false })]; | ||
__esDecorate(this, null, _elements_decorators, { kind: "accessor", name: "elements", static: false, private: false, access: { has: obj => "elements" in obj, get: obj => obj.elements, set: (obj, value) => { obj.elements = value; } }, metadata: _metadata }, _elements_initializers, _elements_extraInitializers); | ||
__esDecorate(this, null, _endOffset_decorators, { kind: "accessor", name: "endOffset", static: false, private: false, access: { has: obj => "endOffset" in obj, get: obj => obj.endOffset, set: (obj, value) => { obj.endOffset = value; } }, metadata: _metadata }, _endOffset_initializers, _endOffset_extraInitializers); | ||
__esDecorate(this, null, _index_decorators, { kind: "accessor", name: "index", static: false, private: false, access: { has: obj => "index" in obj, get: obj => obj.index, set: (obj, value) => { obj.index = value; } }, metadata: _metadata }, _index_initializers, _index_extraInitializers); | ||
__esDecorate(this, null, _startOffset_decorators, { kind: "accessor", name: "startOffset", static: false, private: false, access: { has: obj => "startOffset" in obj, get: obj => obj.startOffset, set: (obj, value) => { obj.startOffset = value; } }, metadata: _metadata }, _startOffset_initializers, _startOffset_extraInitializers); | ||
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); | ||
@@ -87,10 +97,12 @@ } | ||
this.addEventListener('mousedown', e => { | ||
if (e.detail >= 2 && this.startOffset === this.endOffset) { | ||
e.preventDefault(); | ||
return; | ||
} | ||
if (e.detail >= 3) { | ||
e.preventDefault(); | ||
const range = document.createRange(); | ||
range.selectNodeContents(this); | ||
const selection = window.getSelection(); | ||
assertExists(selection); | ||
selection.removeAllRanges(); | ||
selection.addRange(range); | ||
this.inlineEditor.setInlineRange({ | ||
index: this.startOffset, | ||
length: this.endOffset - this.startOffset, | ||
}); | ||
} | ||
@@ -161,8 +173,14 @@ }); | ||
set elements(value) { this.#elements_accessor_storage = value; } | ||
#index_accessor_storage = (__runInitializers(this, _elements_extraInitializers), __runInitializers(this, _index_initializers, void 0)); | ||
#endOffset_accessor_storage = (__runInitializers(this, _elements_extraInitializers), __runInitializers(this, _endOffset_initializers, void 0)); | ||
get endOffset() { return this.#endOffset_accessor_storage; } | ||
set endOffset(value) { this.#endOffset_accessor_storage = value; } | ||
#index_accessor_storage = (__runInitializers(this, _endOffset_extraInitializers), __runInitializers(this, _index_initializers, void 0)); | ||
get index() { return this.#index_accessor_storage; } | ||
set index(value) { this.#index_accessor_storage = value; } | ||
#startOffset_accessor_storage = (__runInitializers(this, _index_extraInitializers), __runInitializers(this, _startOffset_initializers, void 0)); | ||
get startOffset() { return this.#startOffset_accessor_storage; } | ||
set startOffset(value) { this.#startOffset_accessor_storage = value; } | ||
constructor() { | ||
super(...arguments); | ||
__runInitializers(this, _index_extraInitializers); | ||
__runInitializers(this, _startOffset_extraInitializers); | ||
} | ||
@@ -169,0 +187,0 @@ }; |
@@ -71,2 +71,3 @@ /* eslint-disable perfectionist/sort-classes */ | ||
} | ||
const lineStartOffset = deltaIndex; | ||
if (chunk.length > 0) { | ||
@@ -94,6 +95,13 @@ const elements = chunk.map(delta => { | ||
.index=${lineIndex} | ||
.startOffset=${lineStartOffset} | ||
.endOffset=${deltaIndex} | ||
></v-line>`; | ||
} | ||
else { | ||
return html `<v-line .elements=${[]} .index=${lineIndex}></v-line>`; | ||
return html `<v-line | ||
.elements=${[]} | ||
.index=${lineIndex} | ||
.startOffset=${lineStartOffset} | ||
.endOffset=${deltaIndex} | ||
></v-line>`; | ||
} | ||
@@ -100,0 +108,0 @@ }); |
{ | ||
"name": "@blocksuite/inline", | ||
"version": "0.0.0-canary-20241113001418", | ||
"version": "0.0.0-canary-20241114001404", | ||
"description": "A micro editor.", | ||
@@ -85,3 +85,3 @@ "type": "module", | ||
"dependencies": { | ||
"@blocksuite/global": "0.0.0-canary-20241113001418", | ||
"@blocksuite/global": "0.0.0-canary-20241114001404", | ||
"@preact/signals-core": "^1.8.0", | ||
@@ -88,0 +88,0 @@ "zod": "^3.23.8" |
@@ -53,11 +53,13 @@ import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; | ||
this.addEventListener('mousedown', e => { | ||
if (e.detail >= 2 && this.startOffset === this.endOffset) { | ||
e.preventDefault(); | ||
return; | ||
} | ||
if (e.detail >= 3) { | ||
e.preventDefault(); | ||
const range = document.createRange(); | ||
range.selectNodeContents(this); | ||
const selection = window.getSelection(); | ||
assertExists(selection); | ||
selection.removeAllRanges(); | ||
selection.addRange(range); | ||
this.inlineEditor.setInlineRange({ | ||
index: this.startOffset, | ||
length: this.endOffset - this.startOffset, | ||
}); | ||
} | ||
@@ -135,3 +137,9 @@ }); | ||
@property({ attribute: false }) | ||
accessor endOffset!: number; | ||
@property({ attribute: false }) | ||
accessor index!: number; | ||
@property({ attribute: false }) | ||
accessor startOffset!: number; | ||
} | ||
@@ -138,0 +146,0 @@ |
@@ -96,2 +96,3 @@ /* eslint-disable perfectionist/sort-classes */ | ||
const lineStartOffset = deltaIndex; | ||
if (chunk.length > 0) { | ||
@@ -123,5 +124,12 @@ const elements: VLine['elements'] = chunk.map(delta => { | ||
.index=${lineIndex} | ||
.startOffset=${lineStartOffset} | ||
.endOffset=${deltaIndex} | ||
></v-line>`; | ||
} else { | ||
return html`<v-line .elements=${[]} .index=${lineIndex}></v-line>`; | ||
return html`<v-line | ||
.elements=${[]} | ||
.index=${lineIndex} | ||
.startOffset=${lineStartOffset} | ||
.endOffset=${deltaIndex} | ||
></v-line>`; | ||
} | ||
@@ -128,0 +136,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
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
448393
5864
+ Added@blocksuite/global@0.0.0-canary-20241114001404(transitive)
- Removed@blocksuite/global@0.0.0-canary-20241113001418(transitive)