@formicoidea/labre-core 0.42.0 → 0.43.1
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-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-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/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/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-linked-doc-block.js +4 -2
- 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.js +5 -2
- 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-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/index.d.ts +1 -0
- package/dist/_pkgs/affine-block-root/index.js +1 -0
- package/dist/_pkgs/affine-block-root/view.js +2 -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/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 +1 -1
- package/dist/_pkgs/affine-block-surface/extensions/svg-sketch.js +12 -4
- package/dist/_pkgs/affine-block-surface/framework-background/background-view.js +1 -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/renderer/element-highlight-overlay.js +2 -7
- package/dist/_pkgs/affine-block-surface-ref/configs/tooltips.js +2 -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 +3 -1
- package/dist/_pkgs/affine-components/icons/ai.js +3 -3
- package/dist/_pkgs/affine-components/icons/list.js +7 -1
- 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-frame-panel/card/frame-card-title-editor.js +1 -1
- package/dist/_pkgs/affine-fragment-frame-panel/card/frame-card.js +1 -1
- 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/text/edgeless-connector-label-editor.js +3 -2
- package/dist/_pkgs/affine-gfx-connector/toolbar/config.js +23 -7
- 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-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/toolbar/config.js +4 -2
- 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/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 +3 -2
- package/dist/_pkgs/affine-gfx-text/toolbar/actions.js +3 -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-model/consts/text.d.ts +15 -2
- package/dist/_pkgs/affine-model/consts/text.js +25 -1
- 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/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 +20 -0
- package/dist/_pkgs/affine-shared/services/translation-service/chrome.js +81 -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 +5 -1
- 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/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/translations.d.ts +6 -0
- package/dist/_pkgs/affine-widget-edgeless-toolbar/translations.js +10 -0
- package/dist/_pkgs/affine-widget-frame-title/edgeless-frame-title-editor.js +2 -1
- 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/model/surface/role.d.ts +10 -5
- package/dist/commands.js +2 -1
- package/dist/translations.js +5 -0
- package/package.json +5 -1
|
@@ -8,7 +8,7 @@ export const ToDoListTooltip = html `<svg width="170" height="68" viewBox="0 0 1
|
|
|
8
8
|
<g mask="url(#mask0_16460_960)">
|
|
9
9
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.6667 19C12.7462 19 12 19.7462 12 20.6667V27.3333C12 28.2538 12.7462 29 13.6667 29H20.3333C21.2538 29 22 28.2538 22 27.3333V20.6667C22 19.7462 21.2538 19 20.3333 19H13.6667ZM12.9091 20.6667C12.9091 20.2483 13.2483 19.9091 13.6667 19.9091H20.3333C20.7517 19.9091 21.0909 20.2483 21.0909 20.6667V27.3333C21.0909 27.7517 20.7517 28.0909 20.3333 28.0909H13.6667C13.2483 28.0909 12.9091 27.7517 12.9091 27.3333V20.6667Z" fill="#77757D"/>
|
|
10
10
|
<text fill="#121212" xml:space="preserve" style="white-space: pre" font-family="Inter" font-size="10" letter-spacing="0px"><tspan x="28" y="27.6364">Here is an example of todo list.</tspan></text>
|
|
11
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 40.6667C12 39.7462 12.7462 39 13.6667 39H20.3333C21.2538 39 22 39.7462 22 40.6667V47.3333C22 48.2538 21.2538 49 20.3333 49H13.6667C12.7462 49 12 48.2538 12 47.3333V40.6667ZM19.7457 42.5032C19.9232 42.3257 19.9232 42.0379 19.7457 41.8604C19.5681 41.6829 19.2803 41.6829 19.1028 41.8604L16.0909 44.8723L15.2002 43.9816C15.0227 43.8041 14.7349 43.8041 14.5574 43.9816C14.3799 44.1591 14.3799 44.4469 14.5574 44.6244L15.7695 45.8366C15.947 46.0141 16.2348 46.0141 16.4123 45.8366L19.7457 42.5032Z" fill="
|
|
11
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 40.6667C12 39.7462 12.7462 39 13.6667 39H20.3333C21.2538 39 22 39.7462 22 40.6667V47.3333C22 48.2538 21.2538 49 20.3333 49H13.6667C12.7462 49 12 48.2538 12 47.3333V40.6667ZM19.7457 42.5032C19.9232 42.3257 19.9232 42.0379 19.7457 41.8604C19.5681 41.6829 19.2803 41.6829 19.1028 41.8604L16.0909 44.8723L15.2002 43.9816C15.0227 43.8041 14.7349 43.8041 14.5574 43.9816C14.3799 44.1591 14.3799 44.4469 14.5574 44.6244L15.7695 45.8366C15.947 46.0141 16.2348 46.0141 16.4123 45.8366L19.7457 42.5032Z" fill="var(--affine-primary-color)"/>
|
|
12
12
|
<text fill="#8E8D91" xml:space="preserve" style="white-space: pre" font-family="Inter" font-size="10" letter-spacing="0px"><tspan x="28" y="47.6364">Make a list for building preview.</tspan></text>
|
|
13
13
|
</g>
|
|
14
14
|
</svg>
|
|
@@ -172,7 +172,7 @@ export const ToDoListTooltip = html `<svg width="170" height="68" viewBox="0 0 1
|
|
|
172
172
|
<g mask="url(#mask0_16460_960)">
|
|
173
173
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.6667 19C12.7462 19 12 19.7462 12 20.6667V27.3333C12 28.2538 12.7462 29 13.6667 29H20.3333C21.2538 29 22 28.2538 22 27.3333V20.6667C22 19.7462 21.2538 19 20.3333 19H13.6667ZM12.9091 20.6667C12.9091 20.2483 13.2483 19.9091 13.6667 19.9091H20.3333C20.7517 19.9091 21.0909 20.2483 21.0909 20.6667V27.3333C21.0909 27.7517 20.7517 28.0909 20.3333 28.0909H13.6667C13.2483 28.0909 12.9091 27.7517 12.9091 27.3333V20.6667Z" fill="#77757D"/>
|
|
174
174
|
<text fill="#121212" xml:space="preserve" style="white-space: pre" font-family="Inter" font-size="10" letter-spacing="0px"><tspan x="28" y="27.6364">Here is an example of todo list.</tspan></text>
|
|
175
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 40.6667C12 39.7462 12.7462 39 13.6667 39H20.3333C21.2538 39 22 39.7462 22 40.6667V47.3333C22 48.2538 21.2538 49 20.3333 49H13.6667C12.7462 49 12 48.2538 12 47.3333V40.6667ZM19.7457 42.5032C19.9232 42.3257 19.9232 42.0379 19.7457 41.8604C19.5681 41.6829 19.2803 41.6829 19.1028 41.8604L16.0909 44.8723L15.2002 43.9816C15.0227 43.8041 14.7349 43.8041 14.5574 43.9816C14.3799 44.1591 14.3799 44.4469 14.5574 44.6244L15.7695 45.8366C15.947 46.0141 16.2348 46.0141 16.4123 45.8366L19.7457 42.5032Z" fill="
|
|
175
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 40.6667C12 39.7462 12.7462 39 13.6667 39H20.3333C21.2538 39 22 39.7462 22 40.6667V47.3333C22 48.2538 21.2538 49 20.3333 49H13.6667C12.7462 49 12 48.2538 12 47.3333V40.6667ZM19.7457 42.5032C19.9232 42.3257 19.9232 42.0379 19.7457 41.8604C19.5681 41.6829 19.2803 41.6829 19.1028 41.8604L16.0909 44.8723L15.2002 43.9816C15.0227 43.8041 14.7349 43.8041 14.5574 43.9816C14.3799 44.1591 14.3799 44.4469 14.5574 44.6244L15.7695 45.8366C15.947 46.0141 16.2348 46.0141 16.4123 45.8366L19.7457 42.5032Z" fill="var(--affine-primary-color)"/>
|
|
176
176
|
<text fill="#8E8D91" xml:space="preserve" style="white-space: pre" font-family="Inter" font-size="10" letter-spacing="0px"><tspan x="28" y="47.6364">Make a list for building preview.</tspan></text>
|
|
177
177
|
</g>
|
|
178
178
|
</svg>
|
|
@@ -256,10 +256,12 @@ let EdgelessTextBlockComponent = (() => {
|
|
|
256
256
|
const containerStyle = {
|
|
257
257
|
transform: `rotate(${rotate}deg)`,
|
|
258
258
|
transformOrigin: 'center',
|
|
259
|
-
border: `1px solid ${editing ? 'var(--affine
|
|
259
|
+
border: `1px solid ${editing ? 'var(--affine-primary-color)' : 'transparent'}`,
|
|
260
260
|
borderRadius: '4px',
|
|
261
261
|
boxSizing: 'border-box',
|
|
262
|
-
boxShadow: editing
|
|
262
|
+
boxShadow: editing
|
|
263
|
+
? '0px 0px 0px 2px color-mix(in srgb, var(--affine-primary-color) 30%, transparent)'
|
|
264
|
+
: 'none',
|
|
263
265
|
fontWeight: '400',
|
|
264
266
|
lineHeight: 'var(--affine-line-height)',
|
|
265
267
|
minWidth: !hasMaxWidth ? '220px' : undefined,
|
|
@@ -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';
|
|
@@ -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
|
|
@@ -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,
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { indexOverBackgrounds, Overlay, stackedElementsOf, } from '../affine-block-surface/index.js';
|
|
2
2
|
import { FrameworkBackgroundElementModel } from '../affine-model/index.js';
|
|
3
|
-
import { EditPropsStore, translateKey } from '../affine-shared/services/index.js';
|
|
3
|
+
import { EditPropsStore, getChromeAccentColor, translateKey, } from '../affine-shared/services/index.js';
|
|
4
4
|
import { DisposableGroup } from '../global/disposable/index.js';
|
|
5
5
|
import { BlockSuiteError, ErrorCode } from '../global/exceptions/index.js';
|
|
6
6
|
import { Bound, deserializeXYWH, } from '../global/gfx/index.js';
|
|
@@ -65,7 +65,10 @@ export class FrameOverlay extends Overlay {
|
|
|
65
65
|
}
|
|
66
66
|
render(ctx) {
|
|
67
67
|
ctx.beginPath();
|
|
68
|
-
|
|
68
|
+
// The accent read from the theme, not a literal: a canvas context cannot
|
|
69
|
+
// take a `var(…)`, so the token is resolved here (DESIGN.md, The Borrowed
|
|
70
|
+
// Blue Rule).
|
|
71
|
+
ctx.strokeStyle = getChromeAccentColor(this.gfx.std);
|
|
69
72
|
ctx.lineWidth = 2 / this.gfx.viewport.zoom;
|
|
70
73
|
const radius = 2 / this.gfx.viewport.zoom;
|
|
71
74
|
if (this._frame) {
|
|
@@ -42,7 +42,9 @@ export function getListIcon(model, showChildren, onClick) {
|
|
|
42
42
|
@click=${onClick}
|
|
43
43
|
>
|
|
44
44
|
${model.props.checked
|
|
45
|
-
? CheckBoxCheckSolidIcon({
|
|
45
|
+
? CheckBoxCheckSolidIcon({
|
|
46
|
+
style: 'color: var(--affine-primary-color)',
|
|
47
|
+
})
|
|
46
48
|
: CheckBoxUnIcon()}
|
|
47
49
|
</div>`;
|
|
48
50
|
case 'toggle':
|
|
@@ -262,7 +262,7 @@ export const TodoTooltip = html `<svg width="170" height="68" viewBox="0 0 170 6
|
|
|
262
262
|
<g mask="url(#mask0_5604_203551)">
|
|
263
263
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.6667 19C12.7462 19 12 19.7462 12 20.6667V27.3333C12 28.2538 12.7462 29 13.6667 29H20.3333C21.2538 29 22 28.2538 22 27.3333V20.6667C22 19.7462 21.2538 19 20.3333 19H13.6667ZM12.9091 20.6667C12.9091 20.2483 13.2483 19.9091 13.6667 19.9091H20.3333C20.7517 19.9091 21.0909 20.2483 21.0909 20.6667V27.3333C21.0909 27.7517 20.7517 28.0909 20.3333 28.0909H13.6667C13.2483 28.0909 12.9091 27.7517 12.9091 27.3333V20.6667Z" fill="#77757D"/>
|
|
264
264
|
<rect x="28" y="20.1364" width="142" height="8" rx="4" fill="#121212" fill-opacity="0.3"/>
|
|
265
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 40.6667C12 39.7462 12.7462 39 13.6667 39H20.3333C21.2538 39 22 39.7462 22 40.6667V47.3333C22 48.2538 21.2538 49 20.3333 49H13.6667C12.7462 49 12 48.2538 12 47.3333V40.6667ZM19.7457 42.5032C19.9232 42.3257 19.9232 42.0379 19.7457 41.8604C19.5681 41.6829 19.2803 41.6829 19.1028 41.8604L16.0909 44.8723L15.2002 43.9816C15.0227 43.8041 14.7349 43.8041 14.5574 43.9816C14.3799 44.1591 14.3799 44.4469 14.5574 44.6244L15.7695 45.8366C15.947 46.0141 16.2348 46.0141 16.4123 45.8366L19.7457 42.5032Z" fill="
|
|
265
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 40.6667C12 39.7462 12.7462 39 13.6667 39H20.3333C21.2538 39 22 39.7462 22 40.6667V47.3333C22 48.2538 21.2538 49 20.3333 49H13.6667C12.7462 49 12 48.2538 12 47.3333V40.6667ZM19.7457 42.5032C19.9232 42.3257 19.9232 42.0379 19.7457 41.8604C19.5681 41.6829 19.2803 41.6829 19.1028 41.8604L16.0909 44.8723L15.2002 43.9816C15.0227 43.8041 14.7349 43.8041 14.5574 43.9816C14.3799 44.1591 14.3799 44.4469 14.5574 44.6244L15.7695 45.8366C15.947 46.0141 16.2348 46.0141 16.4123 45.8366L19.7457 42.5032Z" fill="var(--affine-primary-color)"/>
|
|
266
266
|
<rect x="28" y="40.1364" width="142" height="8" rx="4" fill="#8E8D91" fill-opacity="0.55"/>
|
|
267
267
|
</g>
|
|
268
268
|
</svg>
|
|
@@ -49,7 +49,7 @@ export const rootBlockHtmlAdapterMatcher = {
|
|
|
49
49
|
display: none;
|
|
50
50
|
}
|
|
51
51
|
label:before {
|
|
52
|
-
background: rgb(30, 150, 235);
|
|
52
|
+
background: var(--affine-primary-color, rgb(30, 150, 235));
|
|
53
53
|
border-radius: 3px;
|
|
54
54
|
height: 16px;
|
|
55
55
|
width: 16px;
|
|
@@ -58,7 +58,7 @@ export const rootBlockHtmlAdapterMatcher = {
|
|
|
58
58
|
}
|
|
59
59
|
input[type='checkbox'] + label:before {
|
|
60
60
|
content: '';
|
|
61
|
-
background: rgb(30, 150, 235);
|
|
61
|
+
background: var(--affine-primary-color, rgb(30, 150, 235));
|
|
62
62
|
color: #fff;
|
|
63
63
|
font-size: 16px;
|
|
64
64
|
line-height: 16px;
|