useblocks 1.3.4 → 1.3.8

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +21 -0
  3. package/iframe/.vite/manifest.json +4 -4
  4. package/iframe/css/sandbox-dark.css +2 -9
  5. package/iframe/css/sandbox-light.css +2 -9
  6. package/iframe/css/sandbox.css +13 -23
  7. package/iframe/{iframe-eblock.6067f806.html → iframe-eblock.a0b8903e.html} +2 -2
  8. package/iframe/{iframe.6067f806.html → iframe.a0b8903e.html} +2 -2
  9. package/iframe/js/elMarkupHelper.C1NUEUOF.js +279 -0
  10. package/iframe/js/{iframe-eblock.body.6067f806.js → iframe-eblock.body.a0b8903e.js} +1 -1
  11. package/iframe/js/iframe-eblock.js +2 -2
  12. package/iframe/js/iframe.body.a0b8903e.js +129 -0
  13. package/iframe/js/iframe.js +2 -2
  14. package/package.json +1 -1
  15. package/runtime/react/index.js +1 -1
  16. package/static/core/{ea7c2c44.js → 1b6e3017.js} +1 -1
  17. package/static/core/2ca6f0ad.js +19 -0
  18. package/static/core/{3e34d695.js → 2d458997.js} +1 -1
  19. package/static/core/{398809e7.js → 31aad6a0.js} +1 -1
  20. package/static/core/3339abc3.js +1 -0
  21. package/static/core/3d73b614.js +1 -0
  22. package/static/core/{0f33f820.js → 3e55fbd4.js} +1 -1
  23. package/static/core/3fc88c79.js +1 -0
  24. package/static/core/{2135fa81.js → 4a69114d.js} +1 -1
  25. package/static/core/4e869a27.js +1 -0
  26. package/static/core/{28a3c758.js → 4f9f6515.js} +1 -1
  27. package/static/core/55a6e3bc.js +163 -0
  28. package/static/core/{d3a3d35f.js → 58b98b23.js} +2 -2
  29. package/static/core/{4f3c76a3.js → 5bf0cc25.js} +1 -1
  30. package/static/core/{17083884.js → 64a5118e.js} +1 -1
  31. package/static/core/{18ab364c.js → 6584ba9a.js} +1 -1
  32. package/static/core/74b30e13.js +1 -0
  33. package/static/core/{19740098.js → 75b3d05d.js} +2 -2
  34. package/static/core/7a1ca179.js +1 -0
  35. package/static/core/{13b95c98.js → 80f29ed0.js} +1 -1
  36. package/static/core/{f8eeeaf9.js → 851da4d1.js} +1 -1
  37. package/static/core/{8b7571c7.js → 88ed7988.js} +1 -1
  38. package/static/core/91a91433.js +1 -0
  39. package/static/core/9f12c233.js +1 -0
  40. package/static/core/{401a0cfb.js → a2fb7ae9.js} +1 -1
  41. package/static/core/a7e83e25.js +10 -0
  42. package/static/core/{5519258a.js → addbb53c.js} +1 -1
  43. package/static/core/{66619f08.js → b1edf5c5.js} +6 -6
  44. package/static/core/{78d9a411.js → b79eddad.js} +1 -1
  45. package/static/core/bd188fca.js +1 -0
  46. package/static/core/{a598ff39.js → c015f53f.js} +1 -1
  47. package/static/core/c0f26c01.js +1 -0
  48. package/static/core/{840b1cdc.js → cad7dc27.js} +1 -1
  49. package/static/core/d4aa63e7.js +1 -0
  50. package/static/core/d5774798.js +1 -0
  51. package/static/core/d5cd129a.js +1 -0
  52. package/static/core/d67c9b4e.js +2 -0
  53. package/static/core/{b060be67.js → d7ccd97b.js} +1 -1
  54. package/static/core/{807a1f00.js → e4ebcc13.js} +1 -1
  55. package/static/core/e6079a68.js +1 -0
  56. package/static/core/{e7a5e467.js → e85778fc.js} +1 -1
  57. package/static/core/ec23adac.js +1 -0
  58. package/static/core/{760dd956.js → f06286dd.js} +1 -1
  59. package/static/core/{7bf0fabd.js → f370243f.js} +1 -1
  60. package/static/core/{eb02ff3a.js → ffabcd69.js} +3 -3
  61. package/static/esm/{3ce60f99.js → b6a1b54a.js} +1 -1
  62. package/static/umd-runtime/{runtime.BqqI2xz2.js → runtime.B77pxBrU.js} +1 -1
  63. package/useblocks-core.a0b8903e.js +874 -0
  64. package/useblocks-esm.js +53 -39
  65. package/{useblocks-po.6067f806.js → useblocks-po.a0b8903e.js} +1 -1
  66. package/useblocks.d.ts +95 -5
  67. package/useblocks.js +54 -40
  68. package/vendor/useblocks-ui-kit/package.json +1 -1
  69. package/iframe/js/elMarkupHelper.CnysQPQn.js +0 -278
  70. package/iframe/js/iframe.body.6067f806.js +0 -129
  71. package/static/core/20f8e2cc.js +0 -1
  72. package/static/core/94ba164b.js +0 -28
  73. package/useblocks-core.6067f806.js +0 -859
package/CHANGELOG.md CHANGED
@@ -6,6 +6,66 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
6
 
7
7
  ---
8
8
 
9
+ ## [Unreleased]
10
+
11
+ ### Added
12
+
13
+ - "Start with a blank email" button on the canvas: appears when the email has nothing to show and brings back the scaffold, so
14
+ blocks can be inserted again
15
+
16
+ ### Changed
17
+
18
+ - An email with erased code now saves empty like any other edit: `save()` no longer refuses with `empty-content`,
19
+ `EMAIL_EMPTY_SAVE_BLOCKED` is no longer fired, and an empty snapshot goes to autosave
20
+ - New plugin email: `show()` without `code` opens the updated scaffold code, and an empty `subject` becomes the
21
+ "New email" subject in the interface language. This subject goes to `<title>` and to `getEmail()`
22
+ - The "Blank template" card creates an email without a server request and without parent blocks
23
+
24
+ ## [1.3.5] - 2026-11-03
25
+
26
+ ### Added
27
+
28
+ - Plugin platform, first stage: `defineCommand`, `defineView`, `domView`, `createSource`, `ok`, `err` and
29
+ `Arg` in `extensions-api`, plus the `Commands` and `Ui` services. A plugin can add its own commands, items
30
+ and panels to the `toolbar`, `sidebar`, `dialog`, `documentSettings`, `menu:document`, `menu:export`,
31
+ `menu:view`, `menu:save`, `statusBar` and `notices` locations
32
+ - Editor commands for plugins: `ui.openView`, `ui.closeView`, `document.getSnapshot`, `document.save` (saves
33
+ the same way as the "Save" button); `useCommand`, `useSource` and `useEditor` hooks in `extensions-react`;
34
+ `extensions-api/testing` test kit
35
+ - Block trash: "Empty trash" button for owners and admins
36
+ - AI layout conversion is now available on paid plans
37
+
38
+ ### Fixed
39
+
40
+ - A copy of a global block is a regular block: `handleCloneBlock` receives `code` without `em-block-id` and
41
+ `em-block-version`, and inserting the copy no longer counts as inserting the original or overwrites it.
42
+ "Create new block" from a copy no longer carries over the previous block's mark either
43
+ - Global block version: renaming and tagging no longer bump it, so emails don't see a fresh block as
44
+ outdated; `saveBlock()` sets a new version
45
+ - "Update current block": a block missing from the loaded list is looked up through `handleReadBlock`, then
46
+ in `handleReadBlocks`; if it isn't found, the edit is refused with `BLOCK_EDITING_ERROR` and
47
+ `handleSaveBlock` never receives an incomplete block. If `handleReadBlock` reports the block is gone, the
48
+ global block is created again
49
+ - The global block update window also appears when entering through the hidden editor, and "Updated" counts
50
+ only the instances actually replaced; the rest are shown as a warning
51
+ - The global block icon on the canvas matches the device icons and no longer breaks the "Drop here" label
52
+ - A new email with no edits is again created after 10 seconds, not after the `autosaveTimeout` interval
53
+ - ESM package: webpack no longer reports "Critical dependency", and its dev server no longer covers the page
54
+ with a warnings overlay
55
+ - Integrator sandbox scripts: `App` from `extensions-sandbox` no longer fails with "App not registered in DI
56
+ container"
57
+ - `ModalApi`: `update()` now changes the open window (the call used to have no effect) and keeps whatever you
58
+ didn't pass; `onClose` fires both on the close icon and on `close(id)`
59
+ - CLI plugin templates: the development stand and the `minimal` template no longer pull in React, the project
60
+ passes `tsc`, and the stand's demo email no longer triggers history requests that return 404
61
+
62
+ ### Changed
63
+
64
+ - An email created by autosave now arrives with `source` set to `AUTOSAVE`. It used to be empty: if you
65
+ detect this case by the empty value, update your check
66
+
67
+ ---
68
+
9
69
  ## [1.2.5] - 2026-10-28
10
70
 
11
71
  ### Added
package/README.md CHANGED
@@ -98,6 +98,26 @@ Webpack/Vite host plugins inject **`__useblocks__ = { publicPath: '...' }`** so
98
98
 
99
99
  For **`useblocks`** the Webpack plugin class is **`UseblocksWebpackPlugin`**.
100
100
 
101
+ ## Caching after a package update
102
+
103
+ The host plugin copies the package's static files into your build, and your server serves them. To have
104
+ users get the new version right after you update the package, with no browser cache reset, split the
105
+ files into two kinds.
106
+
107
+ | Files | `Cache-Control` | Why |
108
+ | --- | --- | --- |
109
+ | Hash in the name: **`useblocks-core.<hash>.js`**, **`useblocks-po.<hash>.js`**, **`static/**/<hash>.js`**, **`iframe/iframe.<hash>.html`**, **`iframe/js/*.<hash>.js`**, **`static/media/*.<hash>.*`** | `public, max-age=31536000, immutable` | New content ships under a new name, so the old file can be kept forever. |
110
+ | No hash: **`useblocks.js`**, **`useblocks-esm.js`**, **`compat-globals.js`**, **`iframe/js/boot-guard.js`**, **`iframe/css/*.css`** and the rest | `no-cache` | The name is the same in every version. The browser keeps the file but checks it with the server before use; if it has not changed, the answer is a short `304`. |
111
+ | Your HTML pages with the editor | `no-cache` | The page has to pick up the new editor entry. |
112
+
113
+ A hash is 8 hex characters (`.f9289386.`; 20 for images and fonts) or 8 base64 characters in the
114
+ **`static/*`** and **`iframe/js`** directories (`DS2seoW7.js`). Other eight-letter names (`Checkbox.js`) are not hashes.
115
+
116
+ Do not put a long `max-age` or `expires` on files without a hash. A cached **`useblocks.js`** points to
117
+ the core and chunks of its own version: after an update the browser keeps starting the old editor, and
118
+ once the old files are removed it gets load errors. If your bundler builds the **`useblocks-esm.js`**
119
+ entry, it names that file itself — then the rule covers only the copied static files.
120
+
101
121
  # Initialization
102
122
 
103
123
  Import the plugin in application code:
@@ -487,6 +507,7 @@ Editor UI tuning. Use **`instance.setConfig`**, **`instance.updateConfig`**, **`
487
507
  | blocksEmptyEnabled | Show empty blocks. | true |
488
508
  | blocksSavedEnabled | Show saved blocks. | true |
489
509
  | blocksCommonEnabled | Show common blocks. | true |
510
+ | blocksCommonSource | Source of common blocks when blocks are stored on Go and `handleReadCommonBlocks` returned nothing: `gallery` — the product gallery, `project` — blocks of the project this plugin key belongs to (insert only). | gallery |
490
511
  | blocksTemplateEnabled | Show template blocks. | true |
491
512
  | blocksSearchEnabled | Show blocks search. | true |
492
513
  | blocksAddPanelEnabled | Show add block panel in visual editor. | true |
@@ -11,8 +11,8 @@
11
11
  "src": "../packages/html2amp/rules.json",
12
12
  "isDynamicEntry": true
13
13
  },
14
- "_elMarkupHelper.CnysQPQn.js": {
15
- "file": "js/elMarkupHelper.CnysQPQn.js",
14
+ "_elMarkupHelper.C1NUEUOF.js": {
15
+ "file": "js/elMarkupHelper.C1NUEUOF.js",
16
16
  "name": "elMarkupHelper",
17
17
  "dynamicImports": [
18
18
  "../packages/html2amp/rules.json",
@@ -26,7 +26,7 @@
26
26
  "src": "iframe-eblock.html",
27
27
  "isEntry": true,
28
28
  "imports": [
29
- "_elMarkupHelper.CnysQPQn.js"
29
+ "_elMarkupHelper.C1NUEUOF.js"
30
30
  ]
31
31
  },
32
32
  "iframe.html": {
@@ -35,7 +35,7 @@
35
35
  "src": "iframe.html",
36
36
  "isEntry": true,
37
37
  "imports": [
38
- "_elMarkupHelper.CnysQPQn.js"
38
+ "_elMarkupHelper.C1NUEUOF.js"
39
39
  ]
40
40
  },
41
41
  "js/typograf/typograf.all.js": {
@@ -38,7 +38,8 @@
38
38
  }
39
39
 
40
40
  [class*='em-show']::before,
41
- [class*='em-amp-show']::before {
41
+ [class*='em-amp-show']::before,
42
+ :where([em='block'][em-block-id]:not(tr), tr[em='block'][em-block-id] > td:first-of-type)::before {
42
43
  color: hsl(0deg 0% 100% / 85%);
43
44
  background-color: #1d1d1d;
44
45
  }
@@ -305,11 +306,3 @@ img[src*='<!--']::after {
305
306
  em-replace::after {
306
307
  background-color: var(--ub-colorBgBase);
307
308
  }
308
-
309
- /* Маркер глобального блока в превью (псевдоэлемент, см. sandbox.css) */
310
- [em='block'][em-block-id]:not(tr)::after,
311
- tr[em='block'][em-block-id] > td:first-of-type::after {
312
- background: rgb(0 0 0 / 0.5);
313
- box-shadow: 0 1px 3px rgb(0 0 0 / 0.35);
314
- color: rgb(255 255 255 / 0.88);
315
- }
@@ -42,7 +42,8 @@
42
42
  }
43
43
 
44
44
  [class*='em-show']::before,
45
- [class*='em-amp-show']::before {
45
+ [class*='em-amp-show']::before,
46
+ :where([em='block'][em-block-id]:not(tr), tr[em='block'][em-block-id] > td:first-of-type)::before {
46
47
  color: #758192;
47
48
  background-color: #fff;
48
49
  }
@@ -201,11 +202,3 @@ img[src*='<!--']::after {
201
202
  em-replace::after {
202
203
  background-color: var(--ub-colorLink);
203
204
  }
204
-
205
- /* Маркер глобального блока в превью (псевдоэлемент, см. sandbox.css) */
206
- [em='block'][em-block-id]:not(tr)::after,
207
- tr[em='block'][em-block-id] > td:first-of-type::after {
208
- background: rgb(255 255 255 / 0.85);
209
- box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
210
- color: #8c8c8c;
211
- }
@@ -335,6 +335,12 @@ td.noresp-em-mob-wrap:nth-child(even) {
335
335
  /* z-index: 999; */
336
336
  }
337
337
 
338
+ /* Подсветка элемента по команде агента: только рамка, раскладка письма не меняется. */
339
+ [em-hover='agent'] {
340
+ outline: 2px solid var(--ub-colorPrimary, #1677ff);
341
+ outline-offset: 2px;
342
+ }
343
+
338
344
  tinymce[em-hover='true'],
339
345
  tinymce *[em-hover='true'] {
340
346
  outline: none !important;
@@ -801,9 +807,11 @@ tinymce *.em-code[em-edit='active'] {
801
807
  position: relative;
802
808
  }
803
809
 
810
+ /* The global block marker has zero specificity: on a drop target the striped band takes this ::before and must override it. */
804
811
  [class*='em-show']::before,
805
812
  .hide-for-small > tbody > tr > td::before,
806
- .hide-for-desktop > tbody > tr > td::before {
813
+ .hide-for-desktop > tbody > tr > td::before,
814
+ :where([em='block'][em-block-id]:not(tr), tr[em='block'][em-block-id] > td:first-of-type)::before {
807
815
  font-family: 'Line Awesome Free';
808
816
  position: absolute;
809
817
  right: 5px;
@@ -867,29 +875,8 @@ tr[em='block'][em-block-id] > td:first-of-type {
867
875
  position: relative;
868
876
  }
869
877
 
870
- [em='block'][em-block-id]:not(tr)::after,
871
- tr[em='block'][em-block-id] > td:first-of-type::after {
872
- font-family: 'Line Awesome Free';
873
- position: absolute;
874
- right: 5px;
875
- top: 5px;
876
- -webkit-font-smoothing: antialiased;
877
- display: flex;
878
- font-style: normal;
879
- font-variant: normal;
880
- text-rendering: auto;
881
- line-height: 1;
882
- font-weight: 900;
883
- font-size: 16px;
884
- width: 26px;
885
- height: 26px;
886
- border-radius: 6px;
887
- text-align: center;
888
- box-sizing: border-box;
878
+ :where([em='block'][em-block-id]:not(tr), tr[em='block'][em-block-id] > td:first-of-type)::before {
889
879
  content: '\f0ac';
890
- z-index: 35;
891
- align-items: center;
892
- justify-content: center;
893
880
  pointer-events: none;
894
881
  }
895
882
 
@@ -1566,6 +1553,9 @@ body:not(.mceNonEditable, .em-sandbox-discuss) .em-blockatom-insert::before {
1566
1553
  box-sizing: border-box;
1567
1554
  margin: 0;
1568
1555
  border: none;
1556
+ border-radius: 0;
1557
+ box-shadow: none;
1558
+ background-color: transparent;
1569
1559
  pointer-events: none;
1570
1560
  }
1571
1561
 
@@ -3,8 +3,8 @@
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
5
5
  <script>var e=window.__useblocks__||(window.__useblocks__={});(function(){"use strict";e===void 0&&(window.__amdEnv={});var t=window.parent&&window.parent!==window?window.parent:null;if(!t||typeof t.postMessage!=`function`)return;var n=`em:module-body`,r=`em:module-body-ack`,i=1e3,a=6e4,o=300,s={},c={},l=0,u=!1,d=!1;function f(){u||typeof window.addEventListener!=`function`||(u=!0,window.addEventListener(`message`,function(e){var n=e&&e.data;if(n&&typeof n==`object`&&e.source===t){if(n.operationId===r){var i=c[n.for];i&&i();return}var a=s[n.operationId];a&&a(n.data)}}))}function p(e){return d?null:(f(),new Promise(function(r){l+=1;var o=`em:body:`+l,u=`em:body-error:`+l,f=!1,p=null;function m(e){f||(f=!0,p!==null&&window.clearTimeout(p),delete s[o],delete s[u],delete c[o],r(e||null))}s[o]=m,s[u]=function(){m(null)},c[o]=function(){p!==null&&window.clearTimeout(p),p=window.setTimeout(function(){m(null)},a)},p=window.setTimeout(function(){d=!0,m(null)},i),t.postMessage({operationId:n,data:{url:e},result:o,error:u},`*`)}))}window.location&&window.location.protocol===`file:`||(e.moduleTransport=p);var m=null;function h(){m=null;try{t.postMessage({mark:`__emmDiagnostics__`,type:`loader`,items:(e.loaderTimings||[]).slice()},`*`)}catch{}}e.onLoaderTiming=function(){m===null&&(m=window.setTimeout(h,o))}})(),(function(){"use strict";e===void 0&&(window.__amdEnv={}),e.bootCanvas=function(t){e.canvasBooted=!0;var n=!1;function r(){if(!n){n=!0;var e=document.createElement(`script`);e.src=t,document.head.appendChild(e)}}var i=e.moduleTransport;if(typeof i!=`function`){r();return}var a;try{a=i(t,t)}catch{a=null}if(!a||typeof a.then!=`function`){r();return}a.then(function(t){if(!t||n){r();return}n=!0;var i=URL.createObjectURL(t),a=document.createElement(`script`);a.src=i,a.onload=function(){URL.revokeObjectURL(i)},a.onerror=function(){URL.revokeObjectURL(i),e.blobBlocked=!0,n=!1,r()},document.head.appendChild(a)},r)}})();
6
- __useblocks__.bootCanvas("./js/iframe-eblock.js?v=6067f806");</script>
7
- <script defer src="./js/boot-guard.js" data-entry="./js/iframe-eblock.js?v=6067f806" data-ns="__useblocks__"></script>
6
+ __useblocks__.bootCanvas("./js/iframe-eblock.js?v=a0b8903e");</script>
7
+ <script defer src="./js/boot-guard.js" data-entry="./js/iframe-eblock.js?v=a0b8903e" data-ns="__useblocks__"></script>
8
8
  </head>
9
9
  <body>
10
10
  </body>
@@ -3,8 +3,8 @@
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
5
5
  <script>var e=window.__useblocks__||(window.__useblocks__={});(function(){"use strict";e===void 0&&(window.__amdEnv={});var t=window.parent&&window.parent!==window?window.parent:null;if(!t||typeof t.postMessage!=`function`)return;var n=`em:module-body`,r=`em:module-body-ack`,i=1e3,a=6e4,o=300,s={},c={},l=0,u=!1,d=!1;function f(){u||typeof window.addEventListener!=`function`||(u=!0,window.addEventListener(`message`,function(e){var n=e&&e.data;if(n&&typeof n==`object`&&e.source===t){if(n.operationId===r){var i=c[n.for];i&&i();return}var a=s[n.operationId];a&&a(n.data)}}))}function p(e){return d?null:(f(),new Promise(function(r){l+=1;var o=`em:body:`+l,u=`em:body-error:`+l,f=!1,p=null;function m(e){f||(f=!0,p!==null&&window.clearTimeout(p),delete s[o],delete s[u],delete c[o],r(e||null))}s[o]=m,s[u]=function(){m(null)},c[o]=function(){p!==null&&window.clearTimeout(p),p=window.setTimeout(function(){m(null)},a)},p=window.setTimeout(function(){d=!0,m(null)},i),t.postMessage({operationId:n,data:{url:e},result:o,error:u},`*`)}))}window.location&&window.location.protocol===`file:`||(e.moduleTransport=p);var m=null;function h(){m=null;try{t.postMessage({mark:`__emmDiagnostics__`,type:`loader`,items:(e.loaderTimings||[]).slice()},`*`)}catch{}}e.onLoaderTiming=function(){m===null&&(m=window.setTimeout(h,o))}})(),(function(){"use strict";e===void 0&&(window.__amdEnv={}),e.bootCanvas=function(t){e.canvasBooted=!0;var n=!1;function r(){if(!n){n=!0;var e=document.createElement(`script`);e.src=t,document.head.appendChild(e)}}var i=e.moduleTransport;if(typeof i!=`function`){r();return}var a;try{a=i(t,t)}catch{a=null}if(!a||typeof a.then!=`function`){r();return}a.then(function(t){if(!t||n){r();return}n=!0;var i=URL.createObjectURL(t),a=document.createElement(`script`);a.src=i,a.onload=function(){URL.revokeObjectURL(i)},a.onerror=function(){URL.revokeObjectURL(i),e.blobBlocked=!0,n=!1,r()},document.head.appendChild(a)},r)}})();
6
- __useblocks__.bootCanvas("./js/iframe.js?v=6067f806");</script>
7
- <script defer src="./js/boot-guard.js" data-entry="./js/iframe.js?v=6067f806" data-ns="__useblocks__"></script>
6
+ __useblocks__.bootCanvas("./js/iframe.js?v=a0b8903e");</script>
7
+ <script defer src="./js/boot-guard.js" data-entry="./js/iframe.js?v=a0b8903e" data-ns="__useblocks__"></script>
8
8
  </head>
9
9
  <body>
10
10
  </body>