@formicoidea/labre-core 0.42.0 → 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-data-view/configs/tooltips.js +1 -1
- package/dist/_pkgs/affine-block-database/configs/tooltips.js +1 -1
- package/dist/_pkgs/affine-block-edgeless-text/edgeless-text-block.js +4 -2
- 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/common/iframe-sandbox.d.ts +39 -0
- package/dist/_pkgs/affine-block-embed/common/iframe-sandbox.js +39 -0
- package/dist/_pkgs/affine-block-embed/configs/toolbar.js +11 -2
- package/dist/_pkgs/affine-block-embed/embed-figma-block/embed-figma-block.js +2 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.d.ts +14 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.js +21 -2
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/configs/toolbar.js +11 -2
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.d.ts +0 -2
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/consts.js +2 -5
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.d.ts +1 -1
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/embed-iframe-block.js +14 -6
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/types.d.ts +16 -0
- package/dist/_pkgs/affine-block-embed/embed-iframe-block/types.js +17 -1
- package/dist/_pkgs/affine-block-embed/embed-loom-block/embed-loom-block.js +2 -0
- package/dist/_pkgs/affine-block-embed/embed-youtube-block/embed-youtube-block.js +2 -0
- package/dist/_pkgs/affine-block-embed/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-embed/index.js +1 -0
- package/dist/_pkgs/affine-block-embed/translations.d.ts +8 -0
- package/dist/_pkgs/affine-block-embed/translations.js +28 -0
- 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-linked-doc-block/embed-linked-doc-block.js +4 -2
- 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-embed-doc/embed-synced-doc-block/embed-synced-doc-block.js +2 -2
- package/dist/_pkgs/affine-block-frame/frame-manager.d.ts +5 -0
- package/dist/_pkgs/affine-block-frame/frame-manager.js +53 -19
- 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-list/utils/get-list-icon.js +3 -1
- package/dist/_pkgs/affine-block-note/configs/tooltips.js +1 -1
- 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/adapters/html.js +2 -2
- package/dist/_pkgs/affine-block-root/commands/copy-link-commands.d.ts +2 -0
- package/dist/_pkgs/affine-block-root/commands/copy-link-commands.js +155 -0
- 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/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-root/index.js +1 -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-root/view.js +2 -0
- 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/interchange-import.js +13 -1
- package/dist/_pkgs/affine-block-surface/extensions/legend.d.ts +8 -0
- package/dist/_pkgs/affine-block-surface/extensions/legend.js +59 -3
- package/dist/_pkgs/affine-block-surface/extensions/morph-toolbar.js +4 -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-translations.d.ts +3 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch-translations.js +23 -0
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.d.ts +112 -4
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +98 -19
- 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/background-view.js +1 -1
- 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/fit.d.ts +36 -0
- package/dist/_pkgs/affine-block-surface/framework-background/fit.js +30 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-surface/framework-background/index.js +1 -0
- 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/element-highlight-overlay.js +2 -7
- 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/configs/tooltips.js +2 -2
- package/dist/_pkgs/affine-block-surface-ref/surface-ref-block.js +12 -2
- package/dist/_pkgs/affine-components/color-picker/palette-carousel.js +5 -0
- package/dist/_pkgs/affine-components/color-picker/styles.js +1 -1
- package/dist/_pkgs/affine-components/context-menu/button.js +17 -1
- package/dist/_pkgs/affine-components/filterable-list/index.js +30 -9
- package/dist/_pkgs/affine-components/icons/ai.js +3 -3
- 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/list.js +7 -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-components/size-dropdown-menu/dropdown-menu.js +6 -1
- package/dist/_pkgs/affine-components/toolbar/index.d.ts +1 -1
- package/dist/_pkgs/affine-components/toolbar/index.js +1 -1
- package/dist/_pkgs/affine-components/toolbar/menu-button.d.ts +7 -0
- package/dist/_pkgs/affine-components/toolbar/menu-button.js +30 -0
- package/dist/_pkgs/affine-components/toolbar/picker-menu.d.ts +16 -1
- package/dist/_pkgs/affine-components/toolbar/picker-menu.js +2 -2
- package/dist/_pkgs/affine-components/toolbar/toolbar.d.ts +1 -0
- package/dist/_pkgs/affine-components/toolbar/toolbar.js +67 -0
- package/dist/_pkgs/affine-fragment-adapter-panel/adapter-panel.d.ts +2 -2
- package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card-title-editor.js +1 -1
- package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.js +3 -3
- 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-brush/toolbar/components/eraser/icons.js +1 -1
- package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.d.ts +11 -2
- package/dist/_pkgs/affine-gfx-connector/direction/direction-reveal.js +11 -2
- 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 +6 -4
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +24 -8
- package/dist/_pkgs/affine-gfx-connector/translations.d.ts +3 -0
- package/dist/_pkgs/affine-gfx-connector/translations.js +23 -0
- package/dist/_pkgs/affine-gfx-group/command/group-api.js +52 -1
- package/dist/_pkgs/affine-gfx-mindmap/indicator-overlay/index.js +6 -2
- package/dist/_pkgs/affine-gfx-mindmap/toolbar/config.js +4 -2
- package/dist/_pkgs/affine-gfx-mindmap/translations.d.ts +6 -0
- package/dist/_pkgs/affine-gfx-mindmap/translations.js +10 -0
- 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 +5 -3
- package/dist/_pkgs/affine-gfx-shape/translations.d.ts +7 -0
- package/dist/_pkgs/affine-gfx-shape/translations.js +11 -0
- package/dist/_pkgs/affine-gfx-template/builtin/other.js +13 -7
- 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-template/toolbar/template-loading.js +1 -1
- package/dist/_pkgs/affine-gfx-template/translations.d.ts +5 -0
- package/dist/_pkgs/affine-gfx-template/translations.js +38 -0
- package/dist/_pkgs/affine-gfx-text/edgeless-text-editor.js +5 -3
- 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 +56 -3
- 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-gfx-text/translations.d.ts +8 -0
- package/dist/_pkgs/affine-gfx-text/translations.js +12 -0
- package/dist/_pkgs/affine-inline-latex/latex-node/latex-editor-menu.js +2 -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 +41 -2
- package/dist/_pkgs/affine-model/consts/text.js +50 -1
- 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/font-loader/config.d.ts +13 -2
- package/dist/_pkgs/affine-shared/services/font-loader/config.js +43 -54
- 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/theme-service.d.ts +19 -0
- package/dist/_pkgs/affine-shared/services/theme-service.js +24 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.d.ts +25 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +90 -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-dragging-area/edgeless-dragging-area-rect.js +2 -2
- package/dist/_pkgs/affine-widget-edgeless-selected-rect/utils.js +15 -4
- package/dist/_pkgs/affine-widget-edgeless-toolbar/catalogue/artefact-catalogue-widget.js +25 -49
- package/dist/_pkgs/affine-widget-edgeless-toolbar/config/types.d.ts +15 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/config/utils.d.ts +1 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/config/utils.js +7 -2
- 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/panel/font-family-panel.d.ts +18 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/panel/font-family-panel.js +52 -6
- 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 +58 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +171 -1
- package/dist/_pkgs/affine-widget-edgeless-toolbar/view.js +10 -0
- package/dist/_pkgs/affine-widget-frame-title/edgeless-frame-title-editor.js +2 -1
- package/dist/_pkgs/affine-widget-note-slicer/note-slicer.js +7 -3
- package/dist/_pkgs/affine-widget-slash-menu/translations.d.ts +16 -0
- package/dist/_pkgs/affine-widget-slash-menu/translations.js +23 -1
- package/dist/_pkgs/affine-widget-toolbar/utils.js +57 -14
- package/dist/_pkgs/data-view/core/detail/field.js +2 -1
- package/dist/_pkgs/data-view/core/filter/literal/define.js +3 -1
- package/dist/_pkgs/data-view/core/group-by/renderer/boolean-group.js +1 -1
- package/dist/_pkgs/data-view/property-presets/checkbox/cell-renderer.js +8 -2
- package/dist/_pkgs/data-view/view-presets/kanban/pc/cell.js +1 -1
- package/dist/_pkgs/data-view/view-presets/kanban/pc/controller/drag.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/drag.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/controller/selection.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/header/vertical-indicator.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc/row/row-select-checkbox.js +3 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/drag.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/controller/selection.js +1 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/group/top/header/vertical-indicator.js +2 -1
- package/dist/_pkgs/data-view/view-presets/table/pc-virtual/row/row-header.js +3 -1
- 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/role.d.ts +10 -5
- 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 +6 -2
- package/dist/translations.js +15 -6
- package/package.json +13 -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
|
@@ -5,6 +5,7 @@ import { EdgelessClipboardEdgelessTextConfig } from './edgeless-clipboard-config
|
|
|
5
5
|
import { EdgelessTextInteraction } from './edgeless-text-block.js';
|
|
6
6
|
import { edgelessTextToolbarExtension } from './edgeless-toolbar/index.js';
|
|
7
7
|
import { effects } from './effects.js';
|
|
8
|
+
import { EdgelessTextSvgPainterExtension } from './svg-painter.js';
|
|
8
9
|
export class EdgelessTextViewExtension extends ViewExtensionProvider {
|
|
9
10
|
constructor() {
|
|
10
11
|
super(...arguments);
|
|
@@ -24,6 +25,7 @@ export class EdgelessTextViewExtension extends ViewExtensionProvider {
|
|
|
24
25
|
context.register(edgelessTextToolbarExtension);
|
|
25
26
|
context.register(EdgelessClipboardEdgelessTextConfig);
|
|
26
27
|
context.register(EdgelessTextInteraction);
|
|
28
|
+
context.register(EdgelessTextSvgPainterExtension);
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The iframe sandbox policy of every embed block, in one place.
|
|
3
|
+
*
|
|
4
|
+
* Every `<iframe>` this package renders points at a third party, so every one
|
|
5
|
+
* of them is sandboxed. The three values below are the only levels there are;
|
|
6
|
+
* see `docs/adr/0028-iframe-sandbox-policy.md` for why.
|
|
7
|
+
*
|
|
8
|
+
* These constants used to live inside `embed-iframe-block/`, out of reach of
|
|
9
|
+
* the sibling blocks of the same package — which is how the dedicated
|
|
10
|
+
* YouTube / Figma / Loom players were shipped with no sandbox at all until
|
|
11
|
+
* issue #389. The policy belongs to the package, not to one block.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Sandbox granted to an embed served by a known provider (spotify, miro, …)
|
|
15
|
+
* through `EmbedIframeConfig`. A provider may widen it through its own
|
|
16
|
+
* `sandbox` option.
|
|
17
|
+
*/
|
|
18
|
+
export declare const TRUSTED_SANDBOX = "allow-same-origin allow-scripts allow-forms allow-presentation";
|
|
19
|
+
/**
|
|
20
|
+
* Sandbox granted to an arbitrary url: the generic provider, or no provider at
|
|
21
|
+
* all. Without `allow-same-origin` the frame runs on an opaque origin.
|
|
22
|
+
*/
|
|
23
|
+
export declare const UNTRUSTED_SANDBOX = "allow-scripts";
|
|
24
|
+
/**
|
|
25
|
+
* Sandbox granted to the dedicated third-party players whose `src` is built
|
|
26
|
+
* from a fixed, hard-coded origin (`www.youtube.com`, `www.figma.com`,
|
|
27
|
+
* `www.loom.com`): they never go through `EmbedIframeConfig`, so this is the
|
|
28
|
+
* only place their policy is written.
|
|
29
|
+
*
|
|
30
|
+
* `allow-same-origin` is not negotiable: without it the YouTube player fails
|
|
31
|
+
* to start (`Cache storage is disabled because the context is sandboxed`) and
|
|
32
|
+
* paints a black frame. It is safe here precisely because the origin is fixed
|
|
33
|
+
* and cross-origin to the host — the frame keeps its own origin and cannot
|
|
34
|
+
* reach the host document.
|
|
35
|
+
*
|
|
36
|
+
* It is `TRUSTED_SANDBOX` minus `allow-forms`: none of these three players has
|
|
37
|
+
* a form to submit, so the capability is not granted.
|
|
38
|
+
*/
|
|
39
|
+
export declare const PROVIDER_PLAYER_SANDBOX = "allow-same-origin allow-scripts allow-presentation";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The iframe sandbox policy of every embed block, in one place.
|
|
3
|
+
*
|
|
4
|
+
* Every `<iframe>` this package renders points at a third party, so every one
|
|
5
|
+
* of them is sandboxed. The three values below are the only levels there are;
|
|
6
|
+
* see `docs/adr/0028-iframe-sandbox-policy.md` for why.
|
|
7
|
+
*
|
|
8
|
+
* These constants used to live inside `embed-iframe-block/`, out of reach of
|
|
9
|
+
* the sibling blocks of the same package — which is how the dedicated
|
|
10
|
+
* YouTube / Figma / Loom players were shipped with no sandbox at all until
|
|
11
|
+
* issue #389. The policy belongs to the package, not to one block.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Sandbox granted to an embed served by a known provider (spotify, miro, …)
|
|
15
|
+
* through `EmbedIframeConfig`. A provider may widen it through its own
|
|
16
|
+
* `sandbox` option.
|
|
17
|
+
*/
|
|
18
|
+
export const TRUSTED_SANDBOX = 'allow-same-origin allow-scripts allow-forms allow-presentation';
|
|
19
|
+
/**
|
|
20
|
+
* Sandbox granted to an arbitrary url: the generic provider, or no provider at
|
|
21
|
+
* all. Without `allow-same-origin` the frame runs on an opaque origin.
|
|
22
|
+
*/
|
|
23
|
+
export const UNTRUSTED_SANDBOX = 'allow-scripts';
|
|
24
|
+
/**
|
|
25
|
+
* Sandbox granted to the dedicated third-party players whose `src` is built
|
|
26
|
+
* from a fixed, hard-coded origin (`www.youtube.com`, `www.figma.com`,
|
|
27
|
+
* `www.loom.com`): they never go through `EmbedIframeConfig`, so this is the
|
|
28
|
+
* only place their policy is written.
|
|
29
|
+
*
|
|
30
|
+
* `allow-same-origin` is not negotiable: without it the YouTube player fails
|
|
31
|
+
* to start (`Cache storage is disabled because the context is sandboxed`) and
|
|
32
|
+
* paints a black frame. It is safe here precisely because the origin is fixed
|
|
33
|
+
* and cross-origin to the host — the frame keeps its own origin and cannot
|
|
34
|
+
* reach the host document.
|
|
35
|
+
*
|
|
36
|
+
* It is `TRUSTED_SANDBOX` minus `allow-forms`: none of these three players has
|
|
37
|
+
* a form to submit, so the capability is not granted.
|
|
38
|
+
*/
|
|
39
|
+
export const PROVIDER_PLAYER_SANDBOX = 'allow-same-origin allow-scripts allow-presentation';
|
|
@@ -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, EmbedGithubModel, EmbedGithubStyles, isExternalEmbedModel, } from '../../affine-model/index.js';
|
|
4
4
|
import { EMBED_CARD_HEIGHT, EMBED_CARD_WIDTH, } from '../../affine-shared/consts/index.js';
|
|
@@ -342,7 +342,16 @@ const createBuiltinSurfaceToolbarConfigForExternal = (klass) => {
|
|
|
342
342
|
const bounds = Bound.deserialize(xywh);
|
|
343
343
|
bounds.w = EMBED_CARD_WIDTH[style];
|
|
344
344
|
bounds.h = EMBED_CARD_HEIGHT[style];
|
|
345
|
-
|
|
345
|
+
// The card takes the embed's place, layer included (ADR 0031 §6).
|
|
346
|
+
const props = {
|
|
347
|
+
url,
|
|
348
|
+
caption,
|
|
349
|
+
style,
|
|
350
|
+
xywh: bounds.serialize(),
|
|
351
|
+
layer: sourceLayerOf(model),
|
|
352
|
+
};
|
|
353
|
+
applyCreationLayer(ctx.std, props);
|
|
354
|
+
const newId = ctx.store.addBlock(flavour, props, parent);
|
|
346
355
|
ctx.command.exec(reassociateConnectorsCommand, { oldId, newId });
|
|
347
356
|
ctx.store.deleteBlock(model);
|
|
348
357
|
// Selects new block
|
|
@@ -4,6 +4,7 @@ import { BlockSelection } from '../../std/index.js';
|
|
|
4
4
|
import { html, nothing } from 'lit';
|
|
5
5
|
import { classMap } from 'lit/directives/class-map.js';
|
|
6
6
|
import { EmbedBlockComponent } from '../common/embed-block-element.js';
|
|
7
|
+
import { PROVIDER_PLAYER_SANDBOX } from '../common/iframe-sandbox.js';
|
|
7
8
|
import { FigmaIcon, styles } from './styles.js';
|
|
8
9
|
export class EmbedFigmaBlockComponent extends EmbedBlockComponent {
|
|
9
10
|
constructor() {
|
|
@@ -69,6 +70,7 @@ export class EmbedFigmaBlockComponent extends EmbedBlockComponent {
|
|
|
69
70
|
allowfullscreen
|
|
70
71
|
loading="lazy"
|
|
71
72
|
credentialless
|
|
73
|
+
sandbox=${PROVIDER_PLAYER_SANDBOX}
|
|
72
74
|
></iframe>
|
|
73
75
|
|
|
74
76
|
<!-- overlay to prevent the iframe from capturing pointer events -->
|
package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import type { EmbedIframeBlockModel } from '../../../affine-model/index.js';
|
|
2
2
|
import type { BlockStdScope } from '../../../std/index.js';
|
|
3
3
|
import { LitElement } from 'lit';
|
|
4
|
-
import type
|
|
4
|
+
import { type EmbedIframeStatusCardOptions } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* The sentence the error card draws under its (translated) title — #390.
|
|
7
|
+
*
|
|
8
|
+
* The card used to render `error.message` raw, which put an English developer
|
|
9
|
+
* sentence under a French heading. An {@link EmbedIframeError} that declared a
|
|
10
|
+
* `messageKey` is resolved through it, with its own `message` as the English
|
|
11
|
+
* fallback; anything else — a plain `Error`, a `BlockSuiteError`, a DI wiring
|
|
12
|
+
* failure — reads one keyed sentence, and its `message` is NEVER displayed.
|
|
13
|
+
*
|
|
14
|
+
* A free function rather than a method so the contract can be tested without
|
|
15
|
+
* mounting a custom element.
|
|
16
|
+
*/
|
|
17
|
+
export declare function embedIframeErrorMessage(std: BlockStdScope, error?: Error | null): string;
|
|
5
18
|
declare const EmbedIframeErrorCard_base: typeof LitElement & import("../../../global/utils/types.js").Constructor<import("../../../global/lit/with-disposable.js").DisposableClass>;
|
|
6
19
|
export declare class EmbedIframeErrorCard extends EmbedIframeErrorCard_base {
|
|
7
20
|
static styles: import("lit").CSSResult;
|
package/dist/_pkgs/affine-block-embed/embed-iframe-block/components/embed-iframe-error-card.js
CHANGED
|
@@ -44,8 +44,27 @@ import { property, query } from 'lit/decorators.js';
|
|
|
44
44
|
import { classMap } from 'lit/directives/class-map.js';
|
|
45
45
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
46
46
|
import { ERROR_CARD_DEFAULT_HEIGHT } from '../consts.js';
|
|
47
|
-
import {
|
|
47
|
+
import { EmbedIframeError } from '../types.js';
|
|
48
|
+
import { EMBED_IFRAME_ERROR_EDIT, EMBED_IFRAME_ERROR_FALLBACK, EMBED_IFRAME_ERROR_TITLE, } from '../../translations.js';
|
|
48
49
|
const LINK_EDIT_POPUP_OFFSET = 12;
|
|
50
|
+
/**
|
|
51
|
+
* The sentence the error card draws under its (translated) title — #390.
|
|
52
|
+
*
|
|
53
|
+
* The card used to render `error.message` raw, which put an English developer
|
|
54
|
+
* sentence under a French heading. An {@link EmbedIframeError} that declared a
|
|
55
|
+
* `messageKey` is resolved through it, with its own `message` as the English
|
|
56
|
+
* fallback; anything else — a plain `Error`, a `BlockSuiteError`, a DI wiring
|
|
57
|
+
* failure — reads one keyed sentence, and its `message` is NEVER displayed.
|
|
58
|
+
*
|
|
59
|
+
* A free function rather than a method so the contract can be tested without
|
|
60
|
+
* mounting a custom element.
|
|
61
|
+
*/
|
|
62
|
+
export function embedIframeErrorMessage(std, error) {
|
|
63
|
+
if (error instanceof EmbedIframeError && error.messageKey) {
|
|
64
|
+
return translateKey(std, error.messageKey, error.message);
|
|
65
|
+
}
|
|
66
|
+
return translateKey(std, ...EMBED_IFRAME_ERROR_FALLBACK);
|
|
67
|
+
}
|
|
49
68
|
let EmbedIframeErrorCard = (() => {
|
|
50
69
|
let _classSuper = WithDisposable(LitElement);
|
|
51
70
|
let __editButton_decorators;
|
|
@@ -268,7 +287,7 @@ let EmbedIframeErrorCard = (() => {
|
|
|
268
287
|
>
|
|
269
288
|
</div>
|
|
270
289
|
<div class="error-message">
|
|
271
|
-
${this.error
|
|
290
|
+
${embedIframeErrorMessage(this.std, this.error)}
|
|
272
291
|
</div>
|
|
273
292
|
<div class="error-info">
|
|
274
293
|
${this.readonly
|
|
@@ -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
|
|
@@ -4,8 +4,6 @@ export declare const EMBED_IFRAME_DEFAULT_CONTAINER_BORDER_RADIUS = 8;
|
|
|
4
4
|
export declare const DEFAULT_IFRAME_HEIGHT = 152;
|
|
5
5
|
export declare const DEFAULT_IFRAME_WIDTH = "100%";
|
|
6
6
|
export declare const LINK_CREATE_POPUP_OFFSET = 4;
|
|
7
|
-
export declare const TRUSTED_SANDBOX = "allow-same-origin allow-scripts allow-forms allow-presentation";
|
|
8
|
-
export declare const UNTRUSTED_SANDBOX = "allow-scripts";
|
|
9
7
|
export declare const IDLE_CARD_DEFAULT_HEIGHT = 48;
|
|
10
8
|
export declare const LOADING_CARD_DEFAULT_HEIGHT = 114;
|
|
11
9
|
export declare const ERROR_CARD_DEFAULT_HEIGHT = 114;
|
|
@@ -4,11 +4,8 @@ export const EMBED_IFRAME_DEFAULT_CONTAINER_BORDER_RADIUS = 8;
|
|
|
4
4
|
export const DEFAULT_IFRAME_HEIGHT = 152;
|
|
5
5
|
export const DEFAULT_IFRAME_WIDTH = '100%';
|
|
6
6
|
export const LINK_CREATE_POPUP_OFFSET = 4;
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
// Sandbox granted to an arbitrary url: the generic provider, or no provider at
|
|
10
|
-
// all. Without `allow-same-origin` the frame runs on an opaque origin.
|
|
11
|
-
export const UNTRUSTED_SANDBOX = 'allow-scripts';
|
|
7
|
+
// The sandbox policy now lives at `../common/iframe-sandbox.ts`, so that every
|
|
8
|
+
// block of this package can read it (issue #389).
|
|
12
9
|
export const IDLE_CARD_DEFAULT_HEIGHT = 48;
|
|
13
10
|
export const LOADING_CARD_DEFAULT_HEIGHT = 114;
|
|
14
11
|
export const ERROR_CARD_DEFAULT_HEIGHT = 114;
|
|
@@ -4,7 +4,7 @@ import { EmbedIframeService, type IframeOptions } from '../../affine-shared/serv
|
|
|
4
4
|
import { type ReadonlySignal } from '@preact/signals-core';
|
|
5
5
|
import { type ClassInfo } from 'lit/directives/class-map.js';
|
|
6
6
|
import type { EmbedLinkInputPopupOptions } from './components/embed-iframe-link-input-popup.js';
|
|
7
|
-
import type
|
|
7
|
+
import { type EmbedIframeStatusCardOptions } from './types.js';
|
|
8
8
|
export type EmbedIframeStatus = 'idle' | 'loading' | 'success' | 'error';
|
|
9
9
|
export declare class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIframeBlockModel> {
|
|
10
10
|
selectedStyle$: ReadonlySignal<ClassInfo> | null;
|
|
@@ -37,7 +37,6 @@ import { CaptionedBlockComponent, SelectedStyle, } from '../../affine-components
|
|
|
37
37
|
import { createLitPortal } from '../../affine-components/portal/index.js';
|
|
38
38
|
import { EmbedIframeService, LinkPreviewServiceIdentifier, NotificationProvider, TOAST_NO_LINK_FOUND, translateKey, } from '../../affine-shared/services/index.js';
|
|
39
39
|
import { matchModels, shouldRefreshOnPropsUpdate, } from '../../affine-shared/utils/index.js';
|
|
40
|
-
import { BlockSuiteError, ErrorCode } from '../../global/exceptions/index.js';
|
|
41
40
|
import { BlockSelection } from '../../std/index.js';
|
|
42
41
|
import { flip, offset, shift } from '@floating-ui/dom';
|
|
43
42
|
import { computed, effect, signal, } from '@preact/signals-core';
|
|
@@ -46,10 +45,12 @@ import { query } from 'lit/decorators.js';
|
|
|
46
45
|
import { classMap } from 'lit/directives/class-map.js';
|
|
47
46
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
48
47
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
49
|
-
import { DEFAULT_IFRAME_HEIGHT, DEFAULT_IFRAME_WIDTH, EMBED_IFRAME_DEFAULT_CONTAINER_BORDER_RADIUS, ERROR_CARD_DEFAULT_HEIGHT, IDLE_CARD_DEFAULT_HEIGHT, LINK_CREATE_POPUP_OFFSET, LOADING_CARD_DEFAULT_HEIGHT,
|
|
48
|
+
import { DEFAULT_IFRAME_HEIGHT, DEFAULT_IFRAME_WIDTH, EMBED_IFRAME_DEFAULT_CONTAINER_BORDER_RADIUS, ERROR_CARD_DEFAULT_HEIGHT, IDLE_CARD_DEFAULT_HEIGHT, LINK_CREATE_POPUP_OFFSET, LOADING_CARD_DEFAULT_HEIGHT, } from './consts.js';
|
|
50
49
|
import { embedIframeBlockStyles } from './style.js';
|
|
50
|
+
import { EmbedIframeError, } from './types.js';
|
|
51
51
|
import { isSafeEmbedUrl, safeGetIframeSrc } from './utils.js';
|
|
52
|
-
import {
|
|
52
|
+
import { TRUSTED_SANDBOX, UNTRUSTED_SANDBOX, } from '../common/iframe-sandbox.js';
|
|
53
|
+
import { EMBED_IFRAME_ERROR_INVALID_URL, EMBED_IFRAME_ERROR_NO_DATA, EMBED_IFRAME_NO_LINK_MESSAGE, } from '../translations.js';
|
|
53
54
|
let EmbedIframeBlockComponent = (() => {
|
|
54
55
|
let _classSuper = CaptionedBlockComponent;
|
|
55
56
|
let __blockContainer_decorators;
|
|
@@ -249,7 +250,10 @@ let EmbedIframeBlockComponent = (() => {
|
|
|
249
250
|
const embedIframeService = this.embedIframeService;
|
|
250
251
|
const linkPreviewService = this.linkPreviewService;
|
|
251
252
|
if (!embedIframeService || !linkPreviewService) {
|
|
252
|
-
|
|
253
|
+
// A DI wiring failure, never a user-facing fact: it declares NO
|
|
254
|
+
// `messageKey`, so the card shows its generic keyed sentence and this
|
|
255
|
+
// technical one stays where a developer reads it (#390).
|
|
256
|
+
throw new EmbedIframeError('EmbedIframeService or LinkPreviewService not found');
|
|
253
257
|
}
|
|
254
258
|
// get embed data and preview data in a promise
|
|
255
259
|
const [embedData, previewData] = await Promise.all([
|
|
@@ -259,7 +263,9 @@ let EmbedIframeBlockComponent = (() => {
|
|
|
259
263
|
// if the embed data is not found, and the iframeUrl is not set, throw an error
|
|
260
264
|
const currentIframeUrl = this.model.props.iframeUrl;
|
|
261
265
|
if (!embedData && !currentIframeUrl) {
|
|
262
|
-
throw new
|
|
266
|
+
throw new EmbedIframeError(EMBED_IFRAME_ERROR_NO_DATA[1], {
|
|
267
|
+
messageKey: EMBED_IFRAME_ERROR_NO_DATA[0],
|
|
268
|
+
});
|
|
263
269
|
}
|
|
264
270
|
// update model
|
|
265
271
|
const iframeUrl = this._getIframeUrl(embedData) ?? currentIframeUrl;
|
|
@@ -366,7 +372,9 @@ let EmbedIframeBlockComponent = (() => {
|
|
|
366
372
|
// the url comes from the document: refuse to give a non http(s) one to src
|
|
367
373
|
if (!isSafeEmbedUrl(iframeUrl)) {
|
|
368
374
|
return html `<embed-iframe-error-card
|
|
369
|
-
.error=${new
|
|
375
|
+
.error=${new EmbedIframeError(EMBED_IFRAME_ERROR_INVALID_URL[1], {
|
|
376
|
+
messageKey: EMBED_IFRAME_ERROR_INVALID_URL[0],
|
|
377
|
+
})}
|
|
370
378
|
.model=${this.model}
|
|
371
379
|
.onRetry=${this._handleRetry}
|
|
372
380
|
.std=${this.std}
|
|
@@ -14,3 +14,19 @@ export type EmbedIframeStatusCardOptions = {
|
|
|
14
14
|
width?: number;
|
|
15
15
|
height?: number;
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* An embed failure that names its own sentence — the `InterchangeImportError`
|
|
19
|
+
* pattern (`blocks/surface/src/extensions/interchange.ts`) applied to the
|
|
20
|
+
* iframe error card (#390).
|
|
21
|
+
*
|
|
22
|
+
* `message` stays the English developer sentence (the console, a test's
|
|
23
|
+
* assertion); `messageKey` is what the CARD renders. An error without a key
|
|
24
|
+
* renders `EMBED_IFRAME_ERROR_FALLBACK`, never its `message`: a sentence
|
|
25
|
+
* written for a developer has no business under a translated title.
|
|
26
|
+
*/
|
|
27
|
+
export declare class EmbedIframeError extends Error {
|
|
28
|
+
readonly messageKey?: string;
|
|
29
|
+
constructor(message: string, options?: {
|
|
30
|
+
messageKey?: string;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -1 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* An embed failure that names its own sentence — the `InterchangeImportError`
|
|
3
|
+
* pattern (`blocks/surface/src/extensions/interchange.ts`) applied to the
|
|
4
|
+
* iframe error card (#390).
|
|
5
|
+
*
|
|
6
|
+
* `message` stays the English developer sentence (the console, a test's
|
|
7
|
+
* assertion); `messageKey` is what the CARD renders. An error without a key
|
|
8
|
+
* renders `EMBED_IFRAME_ERROR_FALLBACK`, never its `message`: a sentence
|
|
9
|
+
* written for a developer has no business under a translated title.
|
|
10
|
+
*/
|
|
11
|
+
export class EmbedIframeError extends Error {
|
|
12
|
+
constructor(message, options) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = 'EmbedIframeError';
|
|
15
|
+
this.messageKey = options?.messageKey;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -42,6 +42,7 @@ import { property } from 'lit/decorators.js';
|
|
|
42
42
|
import { classMap } from 'lit/directives/class-map.js';
|
|
43
43
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
44
44
|
import { EmbedBlockComponent } from '../common/embed-block-element.js';
|
|
45
|
+
import { PROVIDER_PLAYER_SANDBOX } from '../common/iframe-sandbox.js';
|
|
45
46
|
import { getEmbedCardIcons } from '../common/utils.js';
|
|
46
47
|
import { loomUrlRegex } from './embed-loom-model.js';
|
|
47
48
|
import { LoomIcon, styles } from './styles.js';
|
|
@@ -136,6 +137,7 @@ let EmbedLoomBlockComponent = (() => {
|
|
|
136
137
|
allow="fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
137
138
|
loading="lazy"
|
|
138
139
|
credentialless
|
|
140
|
+
sandbox=${PROVIDER_PLAYER_SANDBOX}
|
|
139
141
|
></iframe>
|
|
140
142
|
|
|
141
143
|
<!-- overlay to prevent the iframe from capturing pointer events -->
|
|
@@ -42,6 +42,7 @@ import { property, state } from 'lit/decorators.js';
|
|
|
42
42
|
import { classMap } from 'lit/directives/class-map.js';
|
|
43
43
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
44
44
|
import { EmbedBlockComponent } from '../common/embed-block-element.js';
|
|
45
|
+
import { PROVIDER_PLAYER_SANDBOX } from '../common/iframe-sandbox.js';
|
|
45
46
|
import { getEmbedCardIcons } from '../common/utils.js';
|
|
46
47
|
import { youtubeUrlRegex } from './embed-youtube-model.js';
|
|
47
48
|
import { styles, YoutubeIcon } from './styles.js';
|
|
@@ -153,6 +154,7 @@ let EmbedYoutubeBlockComponent = (() => {
|
|
|
153
154
|
allowfullscreen
|
|
154
155
|
loading="lazy"
|
|
155
156
|
credentialless
|
|
157
|
+
sandbox=${PROVIDER_PLAYER_SANDBOX}
|
|
156
158
|
></iframe>
|
|
157
159
|
|
|
158
160
|
<!-- overlay to prevent the iframe from capturing pointer events -->
|
|
@@ -3,6 +3,7 @@ export { createEmbedBlockMarkdownAdapterMatcher } from './common/adapters/markdo
|
|
|
3
3
|
export { createEmbedBlockPlainTextAdapterMatcher } from './common/adapters/plain-text.js';
|
|
4
4
|
export { createEmbedEdgelessBlockInteraction, EmbedBlockComponent, } from './common/embed-block-element.js';
|
|
5
5
|
export * from './common/embed-note-content-styles.js';
|
|
6
|
+
export { PROVIDER_PLAYER_SANDBOX, TRUSTED_SANDBOX, UNTRUSTED_SANDBOX, } from './common/iframe-sandbox.js';
|
|
6
7
|
export { insertEmbedCard } from './common/insert-embed-card.js';
|
|
7
8
|
export * from './common/render-linked-doc.js';
|
|
8
9
|
export { toEdgelessEmbedBlock } from './common/to-edgeless-embed-block.js';
|
|
@@ -3,6 +3,7 @@ export { createEmbedBlockMarkdownAdapterMatcher } from './common/adapters/markdo
|
|
|
3
3
|
export { createEmbedBlockPlainTextAdapterMatcher } from './common/adapters/plain-text.js';
|
|
4
4
|
export { createEmbedEdgelessBlockInteraction, EmbedBlockComponent, } from './common/embed-block-element.js';
|
|
5
5
|
export * from './common/embed-note-content-styles.js';
|
|
6
|
+
export { PROVIDER_PLAYER_SANDBOX, TRUSTED_SANDBOX, UNTRUSTED_SANDBOX, } from './common/iframe-sandbox.js';
|
|
6
7
|
export { insertEmbedCard } from './common/insert-embed-card.js';
|
|
7
8
|
export * from './common/render-linked-doc.js';
|
|
8
9
|
export { toEdgelessEmbedBlock } from './common/to-edgeless-embed-block.js';
|
|
@@ -18,6 +18,14 @@ export declare const EMBED_IFRAME_SLASH_NAME: ChromeWording;
|
|
|
18
18
|
export declare const EMBED_IFRAME_SLASH_DESCRIPTION: ChromeWording;
|
|
19
19
|
export declare const EMBED_IFRAME_ERROR_TITLE: ChromeWording;
|
|
20
20
|
export declare const EMBED_IFRAME_ERROR_EDIT: ChromeWording;
|
|
21
|
+
export declare const EMBED_IFRAME_ERROR_NO_DATA: ChromeWording;
|
|
22
|
+
export declare const EMBED_IFRAME_ERROR_INVALID_URL: ChromeWording;
|
|
23
|
+
/**
|
|
24
|
+
* What the card says for any error that declares no key of its own —
|
|
25
|
+
* including the DI wiring failure ("EmbedIframeService or LinkPreviewService
|
|
26
|
+
* not found"), which is never a user-facing fact and stays in the console.
|
|
27
|
+
*/
|
|
28
|
+
export declare const EMBED_IFRAME_ERROR_FALLBACK: ChromeWording;
|
|
21
29
|
export declare const EMBED_IFRAME_IDLE_TEXT: ChromeWording;
|
|
22
30
|
export declare const EMBED_IFRAME_INVALID_URL_TITLE: ChromeWording;
|
|
23
31
|
export declare const EMBED_IFRAME_INVALID_URL_MESSAGE: ChromeWording;
|
|
@@ -39,6 +39,31 @@ export const EMBED_IFRAME_ERROR_TITLE = [
|
|
|
39
39
|
'This link couldn’t be loaded.',
|
|
40
40
|
];
|
|
41
41
|
export const EMBED_IFRAME_ERROR_EDIT = TOOLBAR_EDIT;
|
|
42
|
+
/* ── The error card's own sentence (#390) ─────────────────────────────────
|
|
43
|
+
*
|
|
44
|
+
* The card used to render `error.message` raw — a developer sentence thrown
|
|
45
|
+
* by `refreshData`, drawn under a translated title. An `EmbedIframeError`
|
|
46
|
+
* carries a `messageKey` instead (the `InterchangeImportError` pattern,
|
|
47
|
+
* `blocks/surface/src/extensions/interchange.ts`), and the card resolves the
|
|
48
|
+
* key or this fallback, never the raw `message`.
|
|
49
|
+
*/
|
|
50
|
+
export const EMBED_IFRAME_ERROR_NO_DATA = [
|
|
51
|
+
'com.labre.embed.iframe.error.no-embed-data',
|
|
52
|
+
'Failed to get embed data',
|
|
53
|
+
];
|
|
54
|
+
export const EMBED_IFRAME_ERROR_INVALID_URL = [
|
|
55
|
+
'com.labre.embed.iframe.error.invalid-url',
|
|
56
|
+
'Invalid iframe URL',
|
|
57
|
+
];
|
|
58
|
+
/**
|
|
59
|
+
* What the card says for any error that declares no key of its own —
|
|
60
|
+
* including the DI wiring failure ("EmbedIframeService or LinkPreviewService
|
|
61
|
+
* not found"), which is never a user-facing fact and stays in the console.
|
|
62
|
+
*/
|
|
63
|
+
export const EMBED_IFRAME_ERROR_FALLBACK = [
|
|
64
|
+
'com.labre.embed.iframe.error.message',
|
|
65
|
+
'Failed to load embedded content',
|
|
66
|
+
];
|
|
42
67
|
export const EMBED_IFRAME_IDLE_TEXT = [
|
|
43
68
|
'com.labre.embed.iframe.idle.text',
|
|
44
69
|
'Embed anything (Google Drive, Google Docs, Spotify, Miro…)',
|
|
@@ -101,6 +126,9 @@ export const EMBED_WORDINGS = [
|
|
|
101
126
|
EMBED_IFRAME_SLASH_NAME,
|
|
102
127
|
EMBED_IFRAME_SLASH_DESCRIPTION,
|
|
103
128
|
EMBED_IFRAME_ERROR_TITLE,
|
|
129
|
+
EMBED_IFRAME_ERROR_NO_DATA,
|
|
130
|
+
EMBED_IFRAME_ERROR_INVALID_URL,
|
|
131
|
+
EMBED_IFRAME_ERROR_FALLBACK,
|
|
104
132
|
EMBED_IFRAME_IDLE_TEXT,
|
|
105
133
|
EMBED_IFRAME_INVALID_URL_TITLE,
|
|
106
134
|
EMBED_IFRAME_INVALID_URL_MESSAGE,
|
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,
|
|
@@ -38,7 +38,7 @@ import { LoadingIcon } from '../../affine-components/icons/index.js';
|
|
|
38
38
|
import { isPeekable, Peekable } from '../../affine-components/peek/index.js';
|
|
39
39
|
import { RefNodeSlotsProvider } from '../../affine-inline-reference/index.js';
|
|
40
40
|
import { EMBED_CARD_HEIGHT, EMBED_CARD_WIDTH, REFERENCE_NODE, } from '../../affine-shared/consts/index.js';
|
|
41
|
-
import { CHROME_LOADING, CitationProvider, DocDisplayMetaProvider, DocModeProvider, LINKED_DOC_DELETED, LINKED_DOC_EMPTY_PREVIEW, LINKED_DOC_FAILED, OpenDocExtensionIdentifier, ThemeProvider, TOOLBAR_RELOAD, translateKey, whenLinkedDocContentReady, } from '../../affine-shared/services/index.js';
|
|
41
|
+
import { CHROME_LOADING, CHROME_UNTITLED, CitationProvider, DocDisplayMetaProvider, DocModeProvider, LINKED_DOC_DELETED, LINKED_DOC_EMPTY_PREVIEW, LINKED_DOC_FAILED, OpenDocExtensionIdentifier, ThemeProvider, TOOLBAR_RELOAD, translateKey, whenLinkedDocContentReady, } from '../../affine-shared/services/index.js';
|
|
42
42
|
import { cloneReferenceInfo, cloneReferenceInfoWithoutAliases, isNewTabTrigger, isNewViewTrigger, matchModels, referenceToNode, } from '../../affine-shared/utils/index.js';
|
|
43
43
|
import { Bound } from '../../global/gfx/index.js';
|
|
44
44
|
import { ResetIcon } from '@blocksuite/icons/lit';
|
|
@@ -118,7 +118,9 @@ let EmbedLinkedDocBlockComponent = (() => {
|
|
|
118
118
|
}
|
|
119
119
|
static { this.styles = styles; }
|
|
120
120
|
get docTitle() {
|
|
121
|
-
return this.model.props.title ||
|
|
121
|
+
return (this.model.props.title ||
|
|
122
|
+
this.linkedDoc?.meta?.title ||
|
|
123
|
+
translateKey(this.std, ...CHROME_UNTITLED));
|
|
122
124
|
}
|
|
123
125
|
get editorMode() {
|
|
124
126
|
return this._linkedDocMode;
|
|
@@ -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,
|
|
@@ -38,7 +38,7 @@ import { ViewExtensionManagerIdentifier } from '../../affine-ext-loader/index.js
|
|
|
38
38
|
import { RefNodeSlotsProvider, } from '../../affine-inline-reference/index.js';
|
|
39
39
|
import { NoteDisplayMode, } from '../../affine-model/index.js';
|
|
40
40
|
import { REFERENCE_NODE } from '../../affine-shared/consts/index.js';
|
|
41
|
-
import { DocDisplayMetaProvider, DocModeProvider, EditorSettingExtension, EditorSettingProvider, GeneralSettingSchema, ThemeExtensionIdentifier, ThemeProvider, translateKey, } from '../../affine-shared/services/index.js';
|
|
41
|
+
import { CHROME_UNTITLED, DocDisplayMetaProvider, DocModeProvider, EditorSettingExtension, EditorSettingProvider, GeneralSettingSchema, ThemeExtensionIdentifier, ThemeProvider, translateKey, } from '../../affine-shared/services/index.js';
|
|
42
42
|
import { cloneReferenceInfo } from '../../affine-shared/utils/index.js';
|
|
43
43
|
import { Bound, getCommonBound } from '../../global/gfx/index.js';
|
|
44
44
|
import { BlockSelection, BlockStdScope, LifeCycleWatcher, } from '../../std/index.js';
|
|
@@ -405,7 +405,7 @@ let EmbedSyncedDocBlockComponent = (() => {
|
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
407
|
get docTitle() {
|
|
408
|
-
return this.syncedDoc?.meta?.title ||
|
|
408
|
+
return (this.syncedDoc?.meta?.title || translateKey(this.std, ...CHROME_UNTITLED));
|
|
409
409
|
}
|
|
410
410
|
get docUpdatedAt() {
|
|
411
411
|
return this._docUpdatedAt;
|
|
@@ -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
|
*
|