fix: replace activatable to editable

This commit is contained in:
QiShaoXuan 2022-08-24 19:41:06 +08:00
parent 280fb4d8c7
commit 2e2d0b121b
3 changed files with 49 additions and 31 deletions

View File

@ -116,7 +116,7 @@ export class BlockHelper {
: blockOrBlockId;
const blockView = this._editor.getView(block.type);
return blockView.activatable;
return blockView.editable;
}
public async getFlatBlocksUnderParent(
@ -198,7 +198,7 @@ export class BlockHelper {
public async getBlockPropertiesBySelectInfo(selectBlockInfo: SelectBlock) {
const block = await this._editor.getBlockById(selectBlockInfo.blockId);
const blockView = this._editor.getView(block.type);
if (blockView.activatable) {
if (blockView.editable) {
return this.getEditableBlockPropertiesBySelectInfo(
block,
selectBlockInfo

View File

@ -256,11 +256,11 @@ export class Editor implements Virgo {
}
getEditableViews() {
return Object.values(this.views)
.map(view => (view.activatable ? view : null))
.map(view => (view.editable ? view : null))
.filter(v => v);
}
isEditableView(type: string) {
return this.views[type].activatable;
return this.views[type].editable;
}
private async _initBlock(

72
pnpm-lock.yaml generated
View File

@ -413,18 +413,18 @@ importers:
dependencies:
'@codemirror/commands': 6.0.1
'@codemirror/lang-cpp': 6.0.1
'@codemirror/lang-css': 6.0.0
'@codemirror/lang-html': 6.1.0
'@codemirror/lang-css': 6.0.0_bmjizg7gr5ieupmvn5u62mbipm
'@codemirror/lang-html': 6.1.0_@codemirror+view@6.2.0
'@codemirror/lang-java': 6.0.0
'@codemirror/lang-javascript': 6.0.2
'@codemirror/lang-json': 6.0.0
'@codemirror/lang-lezer': 6.0.0
'@codemirror/lang-markdown': 6.0.1
'@codemirror/lang-php': 6.0.0
'@codemirror/lang-php': 6.0.0_@codemirror+view@6.2.0
'@codemirror/lang-python': 6.0.1
'@codemirror/lang-rust': 6.0.0
'@codemirror/lang-sql': 6.1.0
'@codemirror/lang-xml': 6.0.0
'@codemirror/lang-sql': 6.1.0_bmjizg7gr5ieupmvn5u62mbipm
'@codemirror/lang-xml': 6.0.0_@codemirror+view@6.2.0
'@codemirror/language': 6.2.1
'@codemirror/legacy-modes': 6.1.0
'@codemirror/next': 0.16.0
@ -438,7 +438,7 @@ importers:
'@emotion/styled': 11.9.3_dc5dh2wp562rsjxvguwi2i3yzq
'@mui/system': 5.8.7_d6menda4vqwq6peqnkbe7mkj4i
code-example: 3.3.6
codemirror: 6.0.1
codemirror: 6.0.1_@lezer+common@1.0.0
codemirror-lang-elixir: 3.0.0_@codemirror+language@6.2.1
keymap: link:@codemirror/next/keymap
nanoid: 4.0.0
@ -570,9 +570,6 @@ importers:
dependencies:
ffc-js-client-side-sdk: 1.1.5
libs/datasource/jwst/pkg:
specifiers: {}
libs/datasource/jwt:
specifiers:
'@types/debug': ^4.1.7
@ -2261,8 +2258,13 @@ packages:
resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==}
dev: true
/@codemirror/autocomplete/6.0.3:
/@codemirror/autocomplete/6.0.3_nq4pwfkqi5icglf26kczcr4s2i:
resolution: {integrity: sha512-JTSBDC4tUyR8iRmCwQJaYpTXtOZmRn4gKjw1Fu4xIatFPqTJ7m0QRCdkdbzlvMovzjTiuHp4a8WUEB1c/LtiHg==}
peerDependencies:
'@codemirror/language': ^6.0.0
'@codemirror/state': ^6.0.0
'@codemirror/view': ^6.0.0
'@lezer/common': ^1.0.0
dependencies:
'@codemirror/language': 6.2.1
'@codemirror/state': 6.1.1
@ -2286,25 +2288,30 @@ packages:
'@lezer/cpp': 1.0.0
dev: false
/@codemirror/lang-css/6.0.0:
/@codemirror/lang-css/6.0.0_bmjizg7gr5ieupmvn5u62mbipm:
resolution: {integrity: sha512-jBqc+BTuwhNOTlrimFghLlSrN6iFuE44HULKWoR4qKYObhOIl9Lci1iYj6zMIte1XTQmZguNvjXMyr43LUKwSw==}
dependencies:
'@codemirror/autocomplete': 6.0.3
'@codemirror/autocomplete': 6.0.3_nq4pwfkqi5icglf26kczcr4s2i
'@codemirror/language': 6.2.1
'@codemirror/state': 6.1.1
'@lezer/css': 1.0.0
transitivePeerDependencies:
- '@codemirror/view'
- '@lezer/common'
dev: false
/@codemirror/lang-html/6.1.0:
/@codemirror/lang-html/6.1.0_@codemirror+view@6.2.0:
resolution: {integrity: sha512-gA7NmJxqvnhwza05CvR7W/39Ap9r/4Vs9uiC0IeFYo1hSlJzc/8N6Evviz6vTW1x8SpHcRYyqKOf6rpl6LfWtg==}
dependencies:
'@codemirror/autocomplete': 6.0.3
'@codemirror/lang-css': 6.0.0
'@codemirror/autocomplete': 6.0.3_nq4pwfkqi5icglf26kczcr4s2i
'@codemirror/lang-css': 6.0.0_bmjizg7gr5ieupmvn5u62mbipm
'@codemirror/lang-javascript': 6.0.2
'@codemirror/language': 6.2.1
'@codemirror/state': 6.1.1
'@lezer/common': 1.0.0
'@lezer/html': 1.0.0
transitivePeerDependencies:
- '@codemirror/view'
dev: false
/@codemirror/lang-java/6.0.0:
@ -2317,7 +2324,7 @@ packages:
/@codemirror/lang-javascript/6.0.2:
resolution: {integrity: sha512-BZRJ9u/zl16hLkSpDAWm73mrfIR7HJrr0lvnhoSOCQVea5BglguWI/slxexhvUb0CB5cXgKWuo2bM+N9EhIaZw==}
dependencies:
'@codemirror/autocomplete': 6.0.3
'@codemirror/autocomplete': 6.0.3_nq4pwfkqi5icglf26kczcr4s2i
'@codemirror/language': 6.2.1
'@codemirror/lint': 6.0.0
'@codemirror/state': 6.1.1
@ -2345,7 +2352,7 @@ packages:
/@codemirror/lang-markdown/6.0.1:
resolution: {integrity: sha512-pHPQuRwf9cUrmkmsTHRjtS9ZnGu3fA9YzAdh2++d+L9wbfnC2XbKh0Xvm/0YiUjdCnoCx9wDFEoCuAnkqKWLIw==}
dependencies:
'@codemirror/lang-html': 6.1.0
'@codemirror/lang-html': 6.1.0_@codemirror+view@6.2.0
'@codemirror/language': 6.2.1
'@codemirror/state': 6.1.1
'@codemirror/view': 6.2.0
@ -2353,14 +2360,16 @@ packages:
'@lezer/markdown': 1.0.1
dev: false
/@codemirror/lang-php/6.0.0:
/@codemirror/lang-php/6.0.0_@codemirror+view@6.2.0:
resolution: {integrity: sha512-96CEjq0xEgbzc6bdFPwILPfZ6m8917JRbh2oPszZJABlYxG4Y+eYjtYkUTDb4yuyjQKyigHoeGC6zoIOYA1NWA==}
dependencies:
'@codemirror/lang-html': 6.1.0
'@codemirror/lang-html': 6.1.0_@codemirror+view@6.2.0
'@codemirror/language': 6.2.1
'@codemirror/state': 6.1.1
'@lezer/common': 1.0.0
'@lezer/php': 1.0.0
transitivePeerDependencies:
- '@codemirror/view'
dev: false
/@codemirror/lang-python/6.0.1:
@ -2377,24 +2386,29 @@ packages:
'@lezer/rust': 1.0.0
dev: false
/@codemirror/lang-sql/6.1.0:
/@codemirror/lang-sql/6.1.0_bmjizg7gr5ieupmvn5u62mbipm:
resolution: {integrity: sha512-eTNTP0+uNHqYClCvJ3QGE7mn1S96QJFNsK76dB4c1pYAQjbgVVjy5DqtD3//A44rp2kuRkgBccRaPKrWDzBdNQ==}
dependencies:
'@codemirror/autocomplete': 6.0.3
'@codemirror/autocomplete': 6.0.3_nq4pwfkqi5icglf26kczcr4s2i
'@codemirror/language': 6.2.1
'@codemirror/state': 6.1.1
'@lezer/highlight': 1.0.0
'@lezer/lr': 1.2.0
transitivePeerDependencies:
- '@codemirror/view'
- '@lezer/common'
dev: false
/@codemirror/lang-xml/6.0.0:
/@codemirror/lang-xml/6.0.0_@codemirror+view@6.2.0:
resolution: {integrity: sha512-M/HLWxIiP956xGjtrxkeHkCmDGVQGKu782x8pOH5CLJIMkWtiB1DWfDoDHqpFjdEE9dkfcqPWvYfVi6GbhuXEg==}
dependencies:
'@codemirror/autocomplete': 6.0.3
'@codemirror/autocomplete': 6.0.3_nq4pwfkqi5icglf26kczcr4s2i
'@codemirror/language': 6.2.1
'@codemirror/state': 6.1.1
'@lezer/common': 1.0.0
'@lezer/xml': 1.0.0
transitivePeerDependencies:
- '@codemirror/view'
dev: false
/@codemirror/language/6.2.1:
@ -7127,8 +7141,10 @@ packages:
indent-string: 4.0.0
dev: true
/ajv-formats/2.1.1:
/ajv-formats/2.1.1_ajv@8.11.0:
resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==}
peerDependencies:
ajv: ^8.0.0
peerDependenciesMeta:
ajv:
optional: true
@ -8328,16 +8344,18 @@ packages:
'@codemirror/language': 6.2.1
dev: false
/codemirror/6.0.1:
/codemirror/6.0.1_@lezer+common@1.0.0:
resolution: {integrity: sha512-J8j+nZ+CdWmIeFIGXEFbFPtpiYacFMDR8GlHK3IyHQJMCaVRfGx9NT+Hxivv1ckLWPvNdZqndbr/7lVhrf/Svg==}
dependencies:
'@codemirror/autocomplete': 6.0.3
'@codemirror/autocomplete': 6.0.3_nq4pwfkqi5icglf26kczcr4s2i
'@codemirror/commands': 6.0.1
'@codemirror/language': 6.2.1
'@codemirror/lint': 6.0.0
'@codemirror/search': 6.0.0
'@codemirror/state': 6.1.1
'@codemirror/view': 6.2.0
transitivePeerDependencies:
- '@lezer/common'
dev: false
/collect-v8-coverage/1.0.1:
@ -16145,7 +16163,7 @@ packages:
dependencies:
'@types/json-schema': 7.0.11
ajv: 8.11.0
ajv-formats: 2.1.1
ajv-formats: 2.1.1_ajv@8.11.0
ajv-keywords: 5.1.0_ajv@8.11.0
dev: true