@formicoidea/labre-core 0.43.1 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_pkgs/affine-block-attachment/utils.js +4 -0
- package/dist/_pkgs/affine-block-bookmark/configs/toolbar.js +17 -4
- package/dist/_pkgs/affine-block-callout/commands/turn-into-callout.d.ts +29 -0
- package/dist/_pkgs/affine-block-callout/commands/turn-into-callout.js +81 -0
- package/dist/_pkgs/affine-block-callout/configs/slash-menu.js +6 -4
- package/dist/_pkgs/affine-block-callout/configs/turn-into.d.ts +8 -0
- package/dist/_pkgs/affine-block-callout/configs/turn-into.js +19 -0
- package/dist/_pkgs/affine-block-callout/translations.d.ts +4 -2
- package/dist/_pkgs/affine-block-callout/translations.js +4 -2
- package/dist/_pkgs/affine-block-callout/view.js +3 -0
- package/dist/_pkgs/affine-block-code/code-block-service.d.ts +13 -0
- package/dist/_pkgs/affine-block-code/code-block-service.js +26 -0
- package/dist/_pkgs/affine-block-code/code-block.d.ts +6 -0
- package/dist/_pkgs/affine-block-code/code-block.js +11 -2
- package/dist/_pkgs/affine-block-code/code-toolbar/components/lang-button.js +31 -8
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-toolbar/config.d.ts +11 -0
- package/dist/_pkgs/affine-block-edgeless-text/svg-painter.d.ts +20 -0
- package/dist/_pkgs/affine-block-edgeless-text/svg-painter.js +76 -0
- package/dist/_pkgs/affine-block-edgeless-text/view.js +2 -0
- package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -2
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +11 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-edgeless-linked-doc-block.js +3 -1
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/configs/toolbar.js +7 -2
- package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-edgeless-synced-doc-block.js +3 -1
- package/dist/_pkgs/affine-block-frame/frame-manager.d.ts +5 -0
- package/dist/_pkgs/affine-block-frame/frame-manager.js +48 -17
- package/dist/_pkgs/affine-block-frame/frame-tool.js +3 -1
- package/dist/_pkgs/affine-block-image/utils.js +4 -1
- package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.d.ts +8 -0
- package/dist/_pkgs/affine-block-latex/adapters/markdown/preprocessor.js +9 -5
- package/dist/_pkgs/affine-block-note/translations.d.ts +0 -1
- package/dist/_pkgs/affine-block-note/translations.js +0 -5
- package/dist/_pkgs/affine-block-root/configs/toolbar.js +17 -1
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/clipboard.js +2 -1
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/command.js +161 -83
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.d.ts +21 -0
- package/dist/_pkgs/affine-block-root/edgeless/clipboard/paste-order.js +85 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.d.ts +6 -0
- package/dist/_pkgs/affine-block-root/edgeless/edgeless-root-block.js +18 -1
- package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.d.ts +9 -0
- package/dist/_pkgs/affine-block-root/edgeless/utils/clone-utils.js +28 -0
- package/dist/_pkgs/affine-block-root/keyboard/commands.js +9 -6
- package/dist/_pkgs/affine-block-root/preview/edgeless-root-preview-block.js +15 -2
- package/dist/_pkgs/affine-block-surface/adapters/markdown/element-adapter/type.d.ts +1 -1
- package/dist/_pkgs/affine-block-surface/element-model/index.d.ts +1 -1
- package/dist/_pkgs/affine-block-surface/element-model/index.js +1 -1
- package/dist/_pkgs/affine-block-surface/extensions/audit.js +13 -61
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.d.ts +2 -0
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/commands.js +71 -0
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/extensions/canvas-grid/index.js +1 -0
- package/dist/_pkgs/affine-block-surface/extensions/clipboard-config.js +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/crud-extension.js +4 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.d.ts +12 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-manager/export-manager.js +27 -7
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.d.ts +2 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/command.js +22 -3
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.d.ts +6 -3
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/index.js +4 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.d.ts +63 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/parts.js +67 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.d.ts +62 -5
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/render.js +98 -18
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.d.ts +14 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/svg-context.js +82 -1
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.d.ts +2 -2
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/toolbar.js +112 -10
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.d.ts +13 -0
- package/dist/_pkgs/affine-block-surface/extensions/export-svg/translations.js +33 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/index.js +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.d.ts +13 -6
- package/dist/_pkgs/affine-block-surface/extensions/reading-widget.js +26 -10
- package/dist/_pkgs/affine-block-surface/extensions/reading.d.ts +82 -6
- package/dist/_pkgs/affine-block-surface/extensions/reading.js +99 -21
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.d.ts +80 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/actions.js +248 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.d.ts +82 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/commands.js +342 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/index.js +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.d.ts +137 -0
- package/dist/_pkgs/affine-block-surface/extensions/selection-pane/tree.js +323 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +112 -4
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +86 -15
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.d.ts +76 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/actions.js +299 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.d.ts +20 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/active-layer.js +34 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.d.ts +67 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/commands.js +172 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.d.ts +40 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/creation.js +69 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.d.ts +5 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/index.js +5 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.d.ts +10 -0
- package/dist/_pkgs/affine-block-surface/extensions/user-layers/translations.js +14 -0
- package/dist/_pkgs/affine-block-surface/framework-background/facts.d.ts +55 -2
- package/dist/_pkgs/affine-block-surface/framework-background/facts.js +63 -1
- package/dist/_pkgs/affine-block-surface/framework-background/stacking.d.ts +16 -8
- package/dist/_pkgs/affine-block-surface/framework-background/stacking.js +26 -14
- package/dist/_pkgs/affine-block-surface/renderer/canvas-renderer.js +17 -3
- package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.d.ts +3 -1
- package/dist/_pkgs/affine-block-surface/renderer/dom-renderer.js +22 -2
- package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.d.ts +30 -0
- package/dist/_pkgs/affine-block-surface/renderer/paint-predicate.js +29 -0
- package/dist/_pkgs/affine-block-surface/surface-block.js +6 -0
- package/dist/_pkgs/affine-block-surface/surface-model.js +5 -0
- package/dist/_pkgs/affine-block-surface/surface-transformer.js +5 -0
- package/dist/_pkgs/affine-block-surface/tool/default-tool.js +28 -5
- package/dist/_pkgs/affine-block-surface/view.js +23 -1
- package/dist/_pkgs/affine-block-surface-ref/surface-ref-block.js +12 -2
- package/dist/_pkgs/affine-components/context-menu/button.js +14 -0
- package/dist/_pkgs/affine-components/filterable-list/index.js +30 -9
- package/dist/_pkgs/affine-components/icons/index.d.ts +0 -1
- package/dist/_pkgs/affine-components/icons/index.js +0 -1
- package/dist/_pkgs/affine-components/icons/text.d.ts +1 -0
- package/dist/_pkgs/affine-components/icons/text.js +11 -0
- package/dist/_pkgs/affine-fragment-adapter-panel/adapter-panel.d.ts +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.js +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.d.ts +1 -1
- package/dist/_pkgs/affine-fragment-frame-panel/header/frame-panel-header.js +8 -27
- package/dist/_pkgs/affine-fragment-frame-panel/index.d.ts +1 -0
- package/dist/_pkgs/affine-fragment-frame-panel/index.js +1 -0
- package/dist/_pkgs/affine-gfx-connector/element-renderer/connector-dom/index.js +3 -1
- package/dist/_pkgs/affine-gfx-connector/element-renderer/index.js +21 -4
- package/dist/_pkgs/affine-gfx-connector/text/edgeless-connector-label-editor.js +3 -2
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +1 -1
- package/dist/_pkgs/affine-gfx-group/command/group-api.js +52 -1
- package/dist/_pkgs/affine-gfx-shape/element-renderer/shape/index.js +21 -3
- package/dist/_pkgs/affine-gfx-shape/text/edgeless-shape-text-editor.js +2 -0
- package/dist/_pkgs/affine-gfx-shape/toolbar/config.js +1 -1
- package/dist/_pkgs/affine-gfx-template/services/template-middlewares.d.ts +9 -0
- package/dist/_pkgs/affine-gfx-template/services/template-middlewares.js +23 -1
- package/dist/_pkgs/affine-gfx-template/services/template.js +2 -1
- package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +2 -1
- package/dist/_pkgs/affine-gfx-text/element-renderer/index.js +20 -3
- package/dist/_pkgs/affine-gfx-text/element-renderer/utils.d.ts +67 -1
- package/dist/_pkgs/affine-gfx-text/element-renderer/utils.js +101 -0
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.d.ts +11 -0
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +53 -2
- package/dist/_pkgs/affine-gfx-text/toolbar/config.d.ts +11 -0
- package/dist/_pkgs/affine-gfx-text/toolbar/config.js +1 -1
- package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.d.ts +3 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/html-inline.js +31 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.d.ts +4 -0
- package/dist/_pkgs/affine-inline-preset/adapters/html/inline-delta.js +14 -0
- package/dist/_pkgs/affine-inline-preset/command/config.js +21 -3
- package/dist/_pkgs/affine-inline-preset/command/index.d.ts +1 -1
- package/dist/_pkgs/affine-inline-preset/command/index.js +1 -1
- package/dist/_pkgs/affine-inline-preset/command/text-style.d.ts +2 -1
- package/dist/_pkgs/affine-inline-preset/command/text-style.js +1 -0
- package/dist/_pkgs/affine-inline-preset/default-inline-manager.js +2 -1
- package/dist/_pkgs/affine-inline-preset/inline-spec.d.ts +4 -0
- package/dist/_pkgs/affine-inline-preset/inline-spec.js +14 -0
- package/dist/_pkgs/affine-inline-preset/translations.d.ts +2 -2
- package/dist/_pkgs/affine-inline-preset/translations.js +2 -2
- package/dist/_pkgs/affine-model/blocks/attachment/attachment-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/bookmark/bookmark-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.d.ts +1 -1
- package/dist/_pkgs/affine-model/blocks/edgeless-text/edgeless-text-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/embed/iframe/iframe-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/frame/frame-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/image/image-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/latex/latex-model.js +2 -0
- package/dist/_pkgs/affine-model/blocks/note/note-model.js +2 -0
- package/dist/_pkgs/affine-model/consts/text.d.ts +26 -0
- package/dist/_pkgs/affine-model/consts/text.js +25 -0
- package/dist/_pkgs/affine-model/elements/shape/shape.d.ts +6 -1
- package/dist/_pkgs/affine-model/elements/shape/shape.js +14 -1
- package/dist/_pkgs/affine-model/elements/text/text.d.ts +6 -1
- package/dist/_pkgs/affine-model/elements/text/text.js +13 -1
- package/dist/_pkgs/affine-model/utils/helper.js +2 -0
- package/dist/_pkgs/affine-rich-text/conversion.d.ts +25 -0
- package/dist/_pkgs/affine-rich-text/conversion.js +9 -0
- package/dist/_pkgs/affine-rich-text/index.d.ts +1 -1
- package/dist/_pkgs/affine-rich-text/index.js +1 -1
- package/dist/_pkgs/affine-shared/commands/model-crud/replace-selected-text-with-blocks.d.ts +1 -1
- package/dist/_pkgs/affine-shared/services/canvas-grid.d.ts +63 -0
- package/dist/_pkgs/affine-shared/services/canvas-grid.js +109 -0
- package/dist/_pkgs/affine-shared/services/canvas-local-visibility.d.ts +64 -0
- package/dist/_pkgs/affine-shared/services/canvas-local-visibility.js +192 -0
- package/dist/_pkgs/affine-shared/services/edit-props-store.d.ts +27 -0
- package/dist/_pkgs/affine-shared/services/edit-props-store.js +34 -0
- package/dist/_pkgs/affine-shared/services/editor-setting-service.d.ts +3 -0
- package/dist/_pkgs/affine-shared/services/editor-setting-service.js +7 -0
- package/dist/_pkgs/affine-shared/services/feature-flag-service.d.ts +4 -0
- package/dist/_pkgs/affine-shared/services/index.d.ts +3 -0
- package/dist/_pkgs/affine-shared/services/index.js +3 -0
- package/dist/_pkgs/affine-shared/services/selection-pane-service.d.ts +44 -0
- package/dist/_pkgs/affine-shared/services/selection-pane-service.js +28 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/lifecycle.d.ts +69 -0
- package/dist/_pkgs/affine-shared/services/telemetry-service/telemetry-service.d.ts +2 -2
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +5 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +9 -0
- package/dist/_pkgs/affine-shared/styles/index.d.ts +1 -0
- package/dist/_pkgs/affine-shared/styles/index.js +1 -0
- package/dist/_pkgs/affine-shared/styles/panel-header.d.ts +31 -0
- package/dist/_pkgs/affine-shared/styles/panel-header.js +61 -0
- package/dist/_pkgs/affine-shared/styles/text.js +7 -7
- package/dist/_pkgs/affine-shared/types/index.d.ts +6 -0
- package/dist/_pkgs/affine-shared/utils/canvas-export-colors.d.ts +26 -0
- package/dist/_pkgs/affine-shared/utils/canvas-export-colors.js +127 -0
- package/dist/_pkgs/affine-shared/utils/file/filesys.d.ts +8 -11
- package/dist/_pkgs/affine-shared/utils/file/filesys.js +8 -11
- package/dist/_pkgs/affine-shared/utils/index.d.ts +2 -0
- package/dist/_pkgs/affine-shared/utils/index.js +2 -0
- package/dist/_pkgs/affine-shared/utils/label-mode.d.ts +47 -0
- package/dist/_pkgs/affine-shared/utils/label-mode.js +55 -0
- package/dist/_pkgs/affine-shared/utils/model/merge-to-code-model.js +7 -1
- package/dist/_pkgs/affine-shared/utils/model/transform-model.js +5 -0
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +10 -3
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +25 -49
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.d.ts +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/effects.js +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.d.ts +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/index.js +4 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.d.ts +61 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/drop.js +91 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.d.ts +17 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/labels.js +95 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.d.ts +10 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-default.js +31 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.d.ts +26 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-tool.js +82 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.d.ts +170 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/selection-pane/selection-pane-widget.js +1381 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.d.ts +52 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +161 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +10 -0
- package/dist/_pkgs/affine-widget-note-slicer/note-slicer.js +7 -3
- package/dist/_pkgs/std/gfx/controller.d.ts +13 -0
- package/dist/_pkgs/std/gfx/controller.js +22 -2
- package/dist/_pkgs/std/gfx/grid.d.ts +31 -2
- package/dist/_pkgs/std/gfx/index.d.ts +3 -1
- package/dist/_pkgs/std/gfx/index.js +3 -1
- package/dist/_pkgs/std/gfx/interactivity/manager.js +7 -0
- package/dist/_pkgs/std/gfx/layer.js +73 -5
- package/dist/_pkgs/std/gfx/local-visibility.d.ts +88 -0
- package/dist/_pkgs/std/gfx/local-visibility.js +217 -0
- package/dist/_pkgs/std/gfx/model/gfx-block-model.d.ts +13 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.d.ts +34 -0
- package/dist/_pkgs/std/gfx/model/surface/element-model.js +65 -1
- package/dist/_pkgs/std/gfx/model/surface/surface-model.d.ts +27 -0
- package/dist/_pkgs/std/gfx/model/surface/surface-model.js +43 -0
- package/dist/_pkgs/std/gfx/model/surface/user-layers.d.ts +68 -0
- package/dist/_pkgs/std/gfx/model/surface/user-layers.js +127 -0
- package/dist/_pkgs/std/utils/layer.d.ts +10 -0
- package/dist/_pkgs/std/utils/layer.js +64 -13
- package/dist/_pkgs/std/view/element/gfx-block-component.js +10 -2
- package/dist/commands.js +4 -1
- package/dist/translations.js +10 -6
- package/package.json +9 -2
- package/dist/_pkgs/affine-components/icons/file-icons-rc.d.ts +0 -1
- package/dist/_pkgs/affine-components/icons/file-icons-rc.js +0 -130
- package/dist/_pkgs/affine-shared/test-utils/affine-template.d.ts +0 -6
- package/dist/_pkgs/affine-shared/test-utils/affine-template.js +0 -258
- package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.d.ts +0 -8
- package/dist/_pkgs/affine-shared/test-utils/affine-test-utils.js +0 -81
- package/dist/_pkgs/affine-shared/test-utils/create-test-host.d.ts +0 -23
- package/dist/_pkgs/affine-shared/test-utils/create-test-host.js +0 -187
- package/dist/_pkgs/affine-shared/test-utils/index.d.ts +0 -3
- package/dist/_pkgs/affine-shared/test-utils/index.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { reassociateConnectorsCommand } from '../../../affine-block-surface/index.js';
|
|
1
|
+
import { applyCreationLayer, reassociateConnectorsCommand, sourceLayerOf, } from '../../../affine-block-surface/index.js';
|
|
2
2
|
import { toast } from '../../../affine-components/toast/index.js';
|
|
3
3
|
import { BookmarkStyles, EmbedIframeBlockModel } from '../../../affine-model/index.js';
|
|
4
4
|
import { EMBED_CARD_HEIGHT, EMBED_CARD_WIDTH, } from '../../../affine-shared/consts/index.js';
|
|
@@ -292,7 +292,16 @@ export const builtinSurfaceToolbarConfig = {
|
|
|
292
292
|
const bounds = Bound.deserialize(xywh);
|
|
293
293
|
bounds.w = EMBED_CARD_WIDTH[style];
|
|
294
294
|
bounds.h = EMBED_CARD_HEIGHT[style];
|
|
295
|
-
|
|
295
|
+
// The card takes the iframe's place, layer included (ADR 0031 §6).
|
|
296
|
+
const props = {
|
|
297
|
+
url,
|
|
298
|
+
caption,
|
|
299
|
+
style,
|
|
300
|
+
xywh: bounds.serialize(),
|
|
301
|
+
layer: sourceLayerOf(model),
|
|
302
|
+
};
|
|
303
|
+
applyCreationLayer(ctx.std, props);
|
|
304
|
+
const newId = ctx.store.addBlock(flavour, props, parent);
|
|
296
305
|
ctx.command.exec(reassociateConnectorsCommand, { oldId, newId });
|
|
297
306
|
ctx.store.deleteBlock(model);
|
|
298
307
|
// Selects new block
|
package/dist/_pkgs/affine-block-embed-doc/embed-linked-doc-block/embed-edgeless-linked-doc-block.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createEmbedEdgelessBlockInteraction, toEdgelessEmbedBlock, } from '../../affine-block-embed/index.js';
|
|
2
|
-
import { EdgelessCRUDIdentifier, reassociateConnectorsCommand, } from '../../affine-block-surface/index.js';
|
|
2
|
+
import { EdgelessCRUDIdentifier, reassociateConnectorsCommand, sourceLayerOf, } from '../../affine-block-surface/index.js';
|
|
3
3
|
import { EmbedLinkedDocBlockSchema } from '../../affine-model/index.js';
|
|
4
4
|
import { EMBED_CARD_HEIGHT, EMBED_CARD_WIDTH, } from '../../affine-shared/consts/index.js';
|
|
5
5
|
import { cloneReferenceInfoWithoutAliases, isNewTabTrigger, isNewViewTrigger, } from '../../affine-shared/utils/index.js';
|
|
@@ -21,6 +21,8 @@ export class EmbedEdgelessLinkedDocBlockComponent extends toEdgelessEmbedBlock(E
|
|
|
21
21
|
xywh: bound.serialize(),
|
|
22
22
|
caption,
|
|
23
23
|
...cloneReferenceInfoWithoutAliases(this.referenceInfo$.peek()),
|
|
24
|
+
// In the linked doc's layer, not the active one (ADR 0031 §6).
|
|
25
|
+
layer: sourceLayerOf(this.model),
|
|
24
26
|
}, surface);
|
|
25
27
|
this.std.command.exec(reassociateConnectorsCommand, {
|
|
26
28
|
oldId: id,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { applyCreationLayer, sourceLayerOf } from '../../../affine-block-surface/index.js';
|
|
1
2
|
import { toast } from '../../../affine-components/toast/index.js';
|
|
2
3
|
import { EditorChevronDown } from '../../../affine-components/toolbar/index.js';
|
|
3
4
|
import { DEFAULT_NOTE_HEIGHT, DEFAULT_NOTE_WIDTH, EmbedSyncedDocModel, NoteBlockModel, NoteDisplayMode, } from '../../../affine-model/index.js';
|
|
@@ -297,11 +298,15 @@ const builtinSurfaceToolbarConfig = {
|
|
|
297
298
|
PADDING;
|
|
298
299
|
const y = syncedDocModel.elementBound.y;
|
|
299
300
|
const children = await draftedModels;
|
|
300
|
-
const
|
|
301
|
+
const props = {
|
|
301
302
|
xywh: new Bound(x, y, DEFAULT_NOTE_WIDTH, DEFAULT_NOTE_HEIGHT).serialize(),
|
|
302
303
|
index: gfx.layer.generateIndex(),
|
|
303
304
|
displayMode: NoteDisplayMode.EdgelessOnly,
|
|
304
|
-
|
|
305
|
+
// Beside the synced doc, in its layer (ADR 0031 §6).
|
|
306
|
+
layer: sourceLayerOf(syncedDocModel),
|
|
307
|
+
};
|
|
308
|
+
applyCreationLayer(std, props);
|
|
309
|
+
const noteId = std.store.addBlock('affine:note', props, ctx.store.root);
|
|
305
310
|
std.store.addBlock('affine:paragraph', {
|
|
306
311
|
text: new Text([
|
|
307
312
|
{
|
package/dist/_pkgs/affine-block-embed-doc/embed-synced-doc-block/embed-edgeless-synced-doc-block.js
CHANGED
|
@@ -33,7 +33,7 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
|
|
|
33
33
|
return useValue ? value : void 0;
|
|
34
34
|
};
|
|
35
35
|
import { toEdgelessEmbedBlock } from '../../affine-block-embed/index.js';
|
|
36
|
-
import { EdgelessCRUDIdentifier, reassociateConnectorsCommand, } from '../../affine-block-surface/index.js';
|
|
36
|
+
import { EdgelessCRUDIdentifier, reassociateConnectorsCommand, sourceLayerOf, } from '../../affine-block-surface/index.js';
|
|
37
37
|
import {} from '../../affine-model/index.js';
|
|
38
38
|
import { EMBED_CARD_HEIGHT, EMBED_CARD_WIDTH, } from '../../affine-shared/consts/index.js';
|
|
39
39
|
import { ThemeExtensionIdentifier, ThemeProvider, translateKey, } from '../../affine-shared/services/index.js';
|
|
@@ -170,6 +170,8 @@ let EmbedEdgelessSyncedDocBlockComponent = (() => {
|
|
|
170
170
|
caption,
|
|
171
171
|
...this.referenceInfo,
|
|
172
172
|
...aliasInfo,
|
|
173
|
+
// In the synced doc's layer, not the active one (ADR 0031 §6).
|
|
174
|
+
layer: sourceLayerOf(this.model),
|
|
173
175
|
}, surface);
|
|
174
176
|
this.std.command.exec(reassociateConnectorsCommand, {
|
|
175
177
|
oldId: id,
|
|
@@ -20,6 +20,9 @@ export declare const EdgelessFrameManagerIdentifier: import("../global/di/types.
|
|
|
20
20
|
export declare class EdgelessFrameManager extends GfxExtension {
|
|
21
21
|
static key: string;
|
|
22
22
|
private readonly _disposable;
|
|
23
|
+
/** Canvas elements added locally, waiting for the adoption microtask. */
|
|
24
|
+
private readonly _pendingAdoptions;
|
|
25
|
+
private _pendingAdoptionTicks;
|
|
23
26
|
/**
|
|
24
27
|
* Get all sorted frames by presentation orderer,
|
|
25
28
|
* the legacy frame that uses `index` as presentation order
|
|
@@ -67,6 +70,8 @@ export declare class EdgelessFrameManager extends GfxExtension {
|
|
|
67
70
|
*/
|
|
68
71
|
private _watchFrameMoved;
|
|
69
72
|
private _watchElementAdded;
|
|
73
|
+
/** A canvas element just added locally: the frame under it adopts it. */
|
|
74
|
+
private _adoptIfInFrame;
|
|
70
75
|
/**
|
|
71
76
|
* Whether `element` fully encloses `frame`.
|
|
72
77
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { indexOverBackgrounds, Overlay, stackedElementsOf, } from '../affine-block-surface/index.js';
|
|
1
|
+
import { applyCreationLayer, indexOverBackgrounds, Overlay, stackedElementsOf, } from '../affine-block-surface/index.js';
|
|
2
2
|
import { FrameworkBackgroundElementModel } from '../affine-model/index.js';
|
|
3
3
|
import { EditPropsStore, getChromeAccentColor, translateKey, } from '../affine-shared/services/index.js';
|
|
4
4
|
import { DisposableGroup } from '../global/disposable/index.js';
|
|
@@ -103,6 +103,9 @@ export class EdgelessFrameManager extends GfxExtension {
|
|
|
103
103
|
constructor(gfx) {
|
|
104
104
|
super(gfx);
|
|
105
105
|
this._disposable = new DisposableGroup();
|
|
106
|
+
/** Canvas elements added locally, waiting for the adoption microtask. */
|
|
107
|
+
this._pendingAdoptions = [];
|
|
108
|
+
this._pendingAdoptionTicks = 0;
|
|
106
109
|
this._watchElementAdded();
|
|
107
110
|
this._watchFrameMoved();
|
|
108
111
|
}
|
|
@@ -158,6 +161,10 @@ export class EdgelessFrameManager extends GfxExtension {
|
|
|
158
161
|
index: this.frameIndexAt(bound),
|
|
159
162
|
presentationIndex: this.generatePresentationIndex(),
|
|
160
163
|
});
|
|
164
|
+
// The viewer's active layer, like every new model (ADR 0031 §6). Not
|
|
165
|
+
// through the stamped CRUD `addBlock`: it would replace the index
|
|
166
|
+
// `frameIndexAt` just chose.
|
|
167
|
+
applyCreationLayer(this.gfx.std, props);
|
|
161
168
|
const id = this.gfx.doc.addBlock('affine:frame', props, surfaceModel);
|
|
162
169
|
const frameModel = this.gfx.getElementById(id);
|
|
163
170
|
if (!frameModel || !isFrameBlock(frameModel)) {
|
|
@@ -231,7 +238,7 @@ export class EdgelessFrameManager extends GfxExtension {
|
|
|
231
238
|
const { surface: surfaceModel, doc } = this.gfx;
|
|
232
239
|
this._disposable.add(surfaceModel.elementAdded.subscribe(({ id, local }) => {
|
|
233
240
|
const element = surfaceModel.getElementById(id);
|
|
234
|
-
if (element && local) {
|
|
241
|
+
if (element && local && !surfaceModel.store.readonly) {
|
|
235
242
|
// The entire frame detection logic must be in microtask for timing reasons:
|
|
236
243
|
//
|
|
237
244
|
// 1. For connectors: When elementAdded fires, connectors have invalid bounds [0,0,0,0]
|
|
@@ -248,22 +255,23 @@ export class EdgelessFrameManager extends GfxExtension {
|
|
|
248
255
|
// - Connectors have proper bounds calculated (not [0,0,0,0])
|
|
249
256
|
// - getFrameFromPoint() works correctly with valid element centers
|
|
250
257
|
// - All element initialization is complete before frame detection
|
|
258
|
+
//
|
|
259
|
+
// One transaction (one update for the peers) adopts everything a
|
|
260
|
+
// single transaction added — a paste of N elements no longer sends N
|
|
261
|
+
// adoptions. Only the LAST microtask queued does the work, so each
|
|
262
|
+
// element is decided no earlier than its own microtask would have
|
|
263
|
+
// been, connector paths included.
|
|
264
|
+
this._pendingAdoptions.push(element);
|
|
265
|
+
this._pendingAdoptionTicks++;
|
|
251
266
|
queueMicrotask(() => {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
element.hasChild(frame)) {
|
|
267
|
+
if (--this._pendingAdoptionTicks > 0)
|
|
268
|
+
return;
|
|
269
|
+
const elements = this._pendingAdoptions.splice(0);
|
|
270
|
+
if (surfaceModel.store.readonly)
|
|
257
271
|
return;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
// it (e.g. a Wardley map background the frame was drawn on top of).
|
|
262
|
-
if (!element.group &&
|
|
263
|
-
frame &&
|
|
264
|
-
!this._enclosesFrame(element, frame)) {
|
|
265
|
-
this._adoptNewlyCreatedElement(frame, element);
|
|
266
|
-
}
|
|
272
|
+
doc.transact(() => {
|
|
273
|
+
elements.forEach(element => this._adoptIfInFrame(element));
|
|
274
|
+
});
|
|
267
275
|
});
|
|
268
276
|
}
|
|
269
277
|
}));
|
|
@@ -275,11 +283,18 @@ export class EdgelessFrameManager extends GfxExtension {
|
|
|
275
283
|
// cannot write at all, which is how this surfaced (#251). See #242 for
|
|
276
284
|
// the rule: a cascade reacts to local transactions, the receiving peer
|
|
277
285
|
// trusts the sync.
|
|
278
|
-
if (!payload.isLocal)
|
|
286
|
+
if (!payload.isLocal || doc.readonly)
|
|
279
287
|
return;
|
|
280
288
|
if (payload.type === 'add' &&
|
|
281
289
|
payload.model instanceof GfxBlockElementModel &&
|
|
282
290
|
renderableInEdgeless(doc, surfaceModel, payload.model)) {
|
|
291
|
+
// Same guard as the canvas half: a block that already has a parent
|
|
292
|
+
// (restored by undo with its group, or created by a transaction that
|
|
293
|
+
// also wrote its container) is not the frame's to take. Adopting it
|
|
294
|
+
// makes two containers claim one child, and the next duplicate
|
|
295
|
+
// copies that child twice.
|
|
296
|
+
if (payload.model.group)
|
|
297
|
+
return;
|
|
283
298
|
const frame = this.getFrameFromPoint(payload.model.elementBound.center, isFrameBlock(payload.model) ? [payload.model] : []);
|
|
284
299
|
if (!frame)
|
|
285
300
|
return;
|
|
@@ -297,6 +312,22 @@ export class EdgelessFrameManager extends GfxExtension {
|
|
|
297
312
|
}
|
|
298
313
|
}));
|
|
299
314
|
}
|
|
315
|
+
/** A canvas element just added locally: the frame under it adopts it. */
|
|
316
|
+
_adoptIfInFrame(element) {
|
|
317
|
+
const frame = this.getFrameFromPoint(element.elementBound.center);
|
|
318
|
+
if (!frame)
|
|
319
|
+
return;
|
|
320
|
+
// if the container created with a frame, skip it.
|
|
321
|
+
if (isGfxGroupCompatibleModel(element) && element.hasChild(frame)) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
// Only add elements that aren't already grouped, and never let the frame
|
|
325
|
+
// swallow a backdrop that encloses it (e.g. a Wardley map background the
|
|
326
|
+
// frame was drawn on top of).
|
|
327
|
+
if (!element.group && !this._enclosesFrame(element, frame)) {
|
|
328
|
+
this._adoptNewlyCreatedElement(frame, element);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
300
331
|
/**
|
|
301
332
|
* Whether `element` fully encloses `frame`.
|
|
302
333
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DefaultTool, OverlayIdentifier } from '../affine-block-surface/index.js';
|
|
1
|
+
import { applyCreationLayer, DefaultTool, OverlayIdentifier, } from '../affine-block-surface/index.js';
|
|
2
2
|
import { EditPropsStore, TelemetryProvider, translateKey, } from '../affine-shared/services/index.js';
|
|
3
3
|
import { Bound, Vec } from '../global/gfx/index.js';
|
|
4
4
|
import { BaseTool, getTopElements } from '../std/gfx/index.js';
|
|
@@ -61,6 +61,8 @@ export class FrameTool extends BaseTool {
|
|
|
61
61
|
index: this.frameManager.frameIndexAt(bound),
|
|
62
62
|
presentationIndex: this.frameManager.generatePresentationIndex(),
|
|
63
63
|
});
|
|
64
|
+
// The active layer, as `EdgelessFrameManager._addFrameBlock` does.
|
|
65
|
+
applyCreationLayer(this.std, props);
|
|
64
66
|
const id = this.doc.addBlock('affine:frame', props, this.gfx.surface);
|
|
65
67
|
this.std.getOptional(TelemetryProvider)?.track('CanvasElementAdded', {
|
|
66
68
|
control: 'canvas:draw',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { autoResizeElementsCommand } from '../affine-block-surface/index.js';
|
|
1
|
+
import { applyCreationLayer, autoResizeElementsCommand, } from '../affine-block-surface/index.js';
|
|
2
2
|
import { toast } from '../affine-components/toast/index.js';
|
|
3
3
|
import { ImageBlockSchema, } from '../affine-model/index.js';
|
|
4
4
|
import { FileSizeLimitProvider, NativeClipboardProvider, TOAST_DOWNLOAD_IN_PROGRESS, TOAST_UPLOAD_SIZE_LIMIT, translateKey, } from '../affine-shared/services/index.js';
|
|
@@ -234,6 +234,9 @@ export async function addImages(std, files, options) {
|
|
|
234
234
|
},
|
|
235
235
|
};
|
|
236
236
|
});
|
|
237
|
+
// The viewer's active layer, as the CRUD `addBlock` path stamps it
|
|
238
|
+
// (ADR 0031 §6): several blocks at once go straight to `store.addBlocks`.
|
|
239
|
+
blocks.forEach(({ blockProps }) => applyCreationLayer(std, blockProps));
|
|
237
240
|
const blockIds = std.store.addBlocks(blocks, gfx.surface);
|
|
238
241
|
gfx.selection.set({
|
|
239
242
|
elements: blockIds,
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { type MarkdownAdapterPreprocessor } from '../../../affine-shared/adapters/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Preprocess the content to protect code blocks and LaTeX expressions
|
|
4
|
+
* reference issue: https://github.com/remarkjs/react-markdown/issues/785
|
|
5
|
+
* reference comment: https://github.com/remarkjs/react-markdown/issues/785#issuecomment-2307567823
|
|
6
|
+
* @param content - The content to preprocess
|
|
7
|
+
* @returns The preprocessed content
|
|
8
|
+
*/
|
|
9
|
+
export declare function preprocessLatex(content: string): string;
|
|
2
10
|
export declare const LatexMarkdownPreprocessorExtension: import("../../../store/index.js").ExtensionType & {
|
|
3
11
|
identifier: import("../../../global/di/types.js").ServiceIdentifier<MarkdownAdapterPreprocessor>;
|
|
4
12
|
};
|
|
@@ -24,7 +24,7 @@ function escapeMhchem(text) {
|
|
|
24
24
|
* @param content - The content to preprocess
|
|
25
25
|
* @returns The preprocessed content
|
|
26
26
|
*/
|
|
27
|
-
function preprocessLatex(content) {
|
|
27
|
+
export function preprocessLatex(content) {
|
|
28
28
|
// Protect code blocks
|
|
29
29
|
const codeBlocks = [];
|
|
30
30
|
let preprocessedContent = content;
|
|
@@ -32,14 +32,18 @@ function preprocessLatex(content) {
|
|
|
32
32
|
codeBlocks.push(code);
|
|
33
33
|
return `<<CODE_BLOCK_${codeBlocks.length - 1}>>`;
|
|
34
34
|
});
|
|
35
|
-
// Protect existing LaTeX expressions
|
|
35
|
+
// Protect existing LaTeX expressions. Inline delimiters use Pandoc's
|
|
36
|
+
// whitespace and digit rules, with backslash parity preserved: a `$` opens
|
|
37
|
+
// math when not followed by a space, closes it when not preceded by one nor
|
|
38
|
+
// followed by a digit, and an odd backslash run escapes it.
|
|
36
39
|
const latexExpressions = [];
|
|
37
|
-
preprocessedContent = preprocessedContent.replace(/(\$\$[\s\S]*?\$\$|\\\[[\s\S]*?\\\]|\\\(.*?\\\))/g, match => {
|
|
40
|
+
preprocessedContent = preprocessedContent.replace(/(\$\$[\s\S]*?\$\$|\\\[[\s\S]*?\\\]|\\\(.*?\\\)|(?<!\\)(?:\\\\)*\$(?!\s)(?:[^\n$\\]|\\.)*?(?<!\s)\$(?!\d))/g, match => {
|
|
38
41
|
latexExpressions.push(match);
|
|
39
42
|
return `<<LATEX_${latexExpressions.length - 1}>>`;
|
|
40
43
|
});
|
|
41
|
-
// Escape dollar signs that are likely currency indicators
|
|
42
|
-
|
|
44
|
+
// Escape dollar signs that are likely currency indicators. An odd backslash
|
|
45
|
+
// run already escapes the dollar sign, so only an even run (or none) gets one.
|
|
46
|
+
preprocessedContent = preprocessedContent.replace(/(?<!\\)((?:\\\\)*)\$(?=\d)/g, '$1\\$');
|
|
43
47
|
// Restore LaTeX expressions
|
|
44
48
|
preprocessedContent = preprocessedContent.replace(/<<LATEX_(\d+)>>/g, (_, index) => latexExpressions[parseInt(index)]);
|
|
45
49
|
// Restore code blocks
|
|
@@ -57,7 +57,6 @@ export declare const NOTE_BORDER_STYLE_LABEL: ChromeWording;
|
|
|
57
57
|
/** An alias (L7 dedupe): the same word as {@link DISPLAY_MODE_SHOW_IN}, one key. */
|
|
58
58
|
export declare const NOTE_DISPLAY_MODE_SHOW_IN: ChromeWording;
|
|
59
59
|
export declare const NOTE_DISPLAY_MODE_LABEL: ChromeWording;
|
|
60
|
-
export declare const NOTE_DISPLAY_MODE_TOOLTIP: ChromeWording;
|
|
61
60
|
/** An alias (L7 dedupe): the same word as {@link DISPLAY_MODE_BOTH}, one key. */
|
|
62
61
|
export declare const NOTE_DISPLAY_MODE_BOTH: ChromeWording;
|
|
63
62
|
/** An alias (L7 dedupe): the same word as {@link DISPLAY_MODE_EDGELESS}, one key. */
|
|
@@ -143,10 +143,6 @@ export const NOTE_DISPLAY_MODE_LABEL = [
|
|
|
143
143
|
'com.labre.note.display-mode.mode-label',
|
|
144
144
|
'Mode',
|
|
145
145
|
];
|
|
146
|
-
export const NOTE_DISPLAY_MODE_TOOLTIP = [
|
|
147
|
-
'com.labre.note.display-mode.tooltip',
|
|
148
|
-
'Display mode',
|
|
149
|
-
];
|
|
150
146
|
/** An alias (L7 dedupe): the same word as {@link DISPLAY_MODE_BOTH}, one key. */
|
|
151
147
|
export const NOTE_DISPLAY_MODE_BOTH = DISPLAY_MODE_BOTH;
|
|
152
148
|
/** An alias (L7 dedupe): the same word as {@link DISPLAY_MODE_EDGELESS}, one key. */
|
|
@@ -237,7 +233,6 @@ export const NOTE_WORDINGS = [
|
|
|
237
233
|
NOTE_STYLE_CUSTOM_COLOR,
|
|
238
234
|
NOTE_STYLE_PANEL_LABEL,
|
|
239
235
|
NOTE_DISPLAY_MODE_LABEL,
|
|
240
|
-
NOTE_DISPLAY_MODE_TOOLTIP,
|
|
241
236
|
NOTE_TOAST_DISPLAYED_IN_PAGE_MODE,
|
|
242
237
|
NOTE_TOAST_REMOVED_FROM_PAGE_BODY,
|
|
243
238
|
NOTE_TOAST_ADDED_TO_PAGE_BODY,
|
|
@@ -5,7 +5,7 @@ import { toast } from '../../affine-components/toast/index.js';
|
|
|
5
5
|
import { EditorChevronDown } from '../../affine-components/toolbar/index.js';
|
|
6
6
|
import { deleteTextCommand, formatBlockCommand, formatNativeCommand, formatTextCommand, isFormatSupported, textFormatConfigs, } from '../../affine-inline-preset/index.js';
|
|
7
7
|
import { EmbedLinkedDocBlockSchema, EmbedSyncedDocBlockSchema, } from '../../affine-model/index.js';
|
|
8
|
-
import { textConversionConfigs } from '../../affine-rich-text/index.js';
|
|
8
|
+
import { textConversionConfigs, TextConversionEntryIdentifier, } from '../../affine-rich-text/index.js';
|
|
9
9
|
import { copySelectedModelsCommand, deleteSelectedModelsCommand, draftSelectedModelsCommand, duplicateSelectedModelsCommand, getBlockSelectionsCommand, getImageSelectionsCommand, getSelectedBlocksCommand, getSelectedModelsCommand, getTextSelectionCommand, } from '../../affine-shared/commands/index.js';
|
|
10
10
|
import { ActionPlacement, blockCommentToolbarButton, TOAST_COPIED_TO_CLIPBOARD, TOOLBAR_COPY, TOOLBAR_DELETE, TOOLBAR_DUPLICATE, translateKey, } from '../../affine-shared/services/index.js';
|
|
11
11
|
import { tableViewMeta } from '../../data-view/view-presets/index.js';
|
|
@@ -42,6 +42,11 @@ const conversionsActionGroup = {
|
|
|
42
42
|
})
|
|
43
43
|
.run();
|
|
44
44
|
};
|
|
45
|
+
// Conversions a gated block package registers from its own view extension
|
|
46
|
+
// (#418): absent when its flag is off, so never listed statically here.
|
|
47
|
+
const contributed = [
|
|
48
|
+
...std.provider.getAll(TextConversionEntryIdentifier).values(),
|
|
49
|
+
].filter(entry => entry.when(std, selectedModels));
|
|
45
50
|
return {
|
|
46
51
|
content: html `
|
|
47
52
|
<editor-menu-button
|
|
@@ -65,6 +70,17 @@ const conversionsActionGroup = {
|
|
|
65
70
|
${icon}<span class="label">${name}</span>
|
|
66
71
|
</editor-menu-action>
|
|
67
72
|
`)}
|
|
73
|
+
${repeat(contributed, entry => entry.flavour, entry => {
|
|
74
|
+
const label = translateKey(std, ...entry.nameWording);
|
|
75
|
+
return html `
|
|
76
|
+
<editor-menu-action
|
|
77
|
+
aria-label=${label}
|
|
78
|
+
@click=${() => entry.run(std, selectedModels)}
|
|
79
|
+
>
|
|
80
|
+
${entry.icon}<span class="label">${label}</span>
|
|
81
|
+
</editor-menu-action>
|
|
82
|
+
`;
|
|
83
|
+
})}
|
|
68
84
|
</div>
|
|
69
85
|
</editor-menu-button>
|
|
70
86
|
`,
|
|
@@ -7,7 +7,7 @@ import { BookmarkStyles, DEFAULT_NOTE_HEIGHT, DEFAULT_NOTE_WIDTH, FrameBlockMode
|
|
|
7
7
|
import { ClipboardAdapter, decodeClipboardBlobs, ImageProxyService, } from '../../../affine-shared/adapters/index.js';
|
|
8
8
|
import { CANVAS_EXPORT_IGNORE_TAGS, EMBED_CARD_HEIGHT, EMBED_CARD_WIDTH, } from '../../../affine-shared/consts/index.js';
|
|
9
9
|
import { EmbedOptionProvider, ParseDocUrlProvider, TelemetryProvider, } from '../../../affine-shared/services/index.js';
|
|
10
|
-
import { convertToPng, isInsidePageEditor, isTopLevelBlock, isUrlInClipboard, matchModels, referenceToNode, } from '../../../affine-shared/utils/index.js';
|
|
10
|
+
import { convertToPng, isInsidePageEditor, isTopLevelBlock, isUrlInClipboard, matchModels, normalizeCanvasExportColors, referenceToNode, } from '../../../affine-shared/utils/index.js';
|
|
11
11
|
import { DisposableGroup } from '../../../global/disposable/index.js';
|
|
12
12
|
import { BlockSuiteError, ErrorCode } from '../../../global/exceptions/index.js';
|
|
13
13
|
import { Bound, getCommonBound, Vec, } from '../../../global/gfx/index.js';
|
|
@@ -336,6 +336,7 @@ export class EdgelessClipboardController extends PageClipboard {
|
|
|
336
336
|
}
|
|
337
337
|
},
|
|
338
338
|
onclone: async function (documentClone, element) {
|
|
339
|
+
normalizeCanvasExportColors(documentClone, element);
|
|
339
340
|
// html2canvas can't support transform feature
|
|
340
341
|
element.style.setProperty('transform', 'none');
|
|
341
342
|
const layer = documentClone.querySelector('.affine-edgeless-layer');
|