@atlaskit/editor-plugin-synced-block 6.0.16 → 6.0.17
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/AGENTS.md +238 -0
- package/CHANGELOG.md +9 -0
- package/dist/cjs/nodeviews/bodiedSyncedBlock.js +13 -4
- package/dist/es2019/nodeviews/bodiedSyncedBlock.js +10 -3
- package/dist/esm/nodeviews/bodiedSyncedBlock.js +13 -4
- package/dist/types/nodeviews/bodiedSyncedBlock.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/bodiedSyncedBlock.d.ts +1 -0
- package/package.json +3 -3
package/AGENTS.md
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# Synced Blocks — Developer Agent Guide
|
|
2
|
+
|
|
3
|
+
> **Purpose**: This guide helps AI agents and developers implement features, fix bugs, and clean up
|
|
4
|
+
> feature gates in the Synced Blocks codebase. It provides architectural context, key file locations,
|
|
5
|
+
> common patterns, and debugging guidance.
|
|
6
|
+
>
|
|
7
|
+
> **Full Knowledge Base**: [Synced Blocks — Comprehensive Knowledge Base](https://hello.atlassian.net/wiki/spaces/egcuc/pages/6679548384) (Confluence)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Quick Context
|
|
12
|
+
|
|
13
|
+
**Synced Blocks** lets users create reusable content blocks (source) that can be referenced across
|
|
14
|
+
Confluence pages and Jira issue descriptions. Edits to the source propagate to all references in
|
|
15
|
+
near real-time via the Block Service backend and AGG GraphQL WebSocket subscriptions.
|
|
16
|
+
|
|
17
|
+
**Two ADF node types:**
|
|
18
|
+
- `bodiedSyncBlock` — **Source** sync block (contains the editable content)
|
|
19
|
+
- `syncBlock` — **Reference** sync block (renders content fetched from block service)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Package Map
|
|
24
|
+
|
|
25
|
+
### Platform (shared across products)
|
|
26
|
+
|
|
27
|
+
| Package | Path | Purpose |
|
|
28
|
+
|---------|------|---------|
|
|
29
|
+
| **Plugin** | `platform/packages/editor/editor-plugin-synced-block/` | Core editor plugin — registers nodes, toolbar, commands, block menu integration |
|
|
30
|
+
| **Provider** | `platform/packages/editor/editor-synced-block-provider/` | Data layer — store managers, block service API client, ARI generation, permissions, media tokens |
|
|
31
|
+
| **Renderer** | `platform/packages/editor/editor-synced-block-renderer/` | View-mode rendering of reference sync blocks using nested renderer |
|
|
32
|
+
| **Plugin Tests** | `platform/packages/editor/editor-plugin-synced-block-tests/` | Integration tests for the plugin |
|
|
33
|
+
| **Provider Tests** | `platform/packages/editor/editor-synced-block-provider-tests/` | Tests for store managers and provider hooks |
|
|
34
|
+
| **Renderer Tests** | `platform/packages/editor/editor-synced-block-renderer-tests/` | Tests for renderer components |
|
|
35
|
+
|
|
36
|
+
Also touches:
|
|
37
|
+
- `platform/packages/editor/editor-common` — shared types
|
|
38
|
+
- `platform/packages/editor/editor-core` — plugin registration
|
|
39
|
+
- `platform/packages/renderer` — reference rendering in view mode
|
|
40
|
+
|
|
41
|
+
### Confluence
|
|
42
|
+
|
|
43
|
+
| File/Package | Path | Purpose |
|
|
44
|
+
|-------------|------|---------|
|
|
45
|
+
| SyncedBlockProvider | `confluence/next/packages/fabric-providers/src/SyncedBlockProvider.ts` | Wraps platform provider with Confluence config (AGG endpoint, media tokens, permissions) |
|
|
46
|
+
| SyncedBlockPreload | `confluence/next/packages/fabric-providers/src/SyncedBlockPreload.ts` | Preloads sync block data for SSR |
|
|
47
|
+
| SSR Data Loading | `confluence/next/packages/fabric-providers/src/SyncedBlockLoadSSRData.ts` | Loads SSR data |
|
|
48
|
+
| Edit Page Preload | `confluence/next/packages/load-edit-page/src/preload/preloadSyncedBlocksData.ts` | Preloads data for edit page |
|
|
49
|
+
| Editor Preload | `confluence/next/packages/load-edit-page/src/preload/preloadEditorSyncedBlocksData.ts` | Editor-specific preloading |
|
|
50
|
+
| Full Page Editor | `confluence/next/packages/full-page-editor/src/FullPageEditorComponent.tsx` | Integrates sync block plugin into editor |
|
|
51
|
+
|
|
52
|
+
### Jira
|
|
53
|
+
|
|
54
|
+
| File/Package | Path | Purpose |
|
|
55
|
+
|-------------|------|---------|
|
|
56
|
+
| Provider Package | `jira/src/packages/issue/issue-view-synced-block-provider/` | Core Jira integration package |
|
|
57
|
+
| Node Component Hook | `src/useSyncedBlockProviderNodeComponent.tsx` | Creates synced block node components for Jira |
|
|
58
|
+
| Editor HOC | `src/withSyncedBlockProviderEditor.tsx` | Wraps Jira editor with sync block support |
|
|
59
|
+
| Renderer HOC | `src/withSyncedBlockProviderRenderer.tsx` | Wraps Jira renderer with sync block support |
|
|
60
|
+
| Prefetch | `src/prefetchSyncedBlocks.ts` | Prefetches sync block data in issue view |
|
|
61
|
+
| Relay Fetch | `src/useRelaySyncBlockFetchProvider.tsx` | Real-time updates via Relay subscriptions |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Key Concepts
|
|
66
|
+
|
|
67
|
+
### Source vs Reference
|
|
68
|
+
- **Source** (`bodiedSyncBlock`): The original content block. Content is stored in the page ADF AND
|
|
69
|
+
in the Block Service. Editable inline.
|
|
70
|
+
- **Reference** (`syncBlock`): A read-only copy that fetches content from Block Service. Rendered
|
|
71
|
+
via nested renderer. Shows "Synced from [page]" label.
|
|
72
|
+
|
|
73
|
+
### Data Flow
|
|
74
|
+
1. **Create source** → Content saved to Block Service via API → ARI generated from page ID + local ID
|
|
75
|
+
2. **Create reference** → Copy source link → Paste → `syncBlock` node inserted with `resourceId`
|
|
76
|
+
3. **Edit source** → Content pushed to Block Service → AGG subscription notifies references → References re-fetch and re-render
|
|
77
|
+
4. **SSR** → On page load, Confluence/Jira preloads sync block data from Block Service in bulk
|
|
78
|
+
|
|
79
|
+
### ARI Format
|
|
80
|
+
- Confluence: `ari:cloud:block::{cloudId}/confluence-page:{pageId}/{localId}`
|
|
81
|
+
- Jira: `ari:cloud:block::{cloudId}/jira-work-item:{issueId}/{localId}`
|
|
82
|
+
|
|
83
|
+
### Store Managers
|
|
84
|
+
- `SyncBlockStoreManager` — Manages source sync block state (create, update, delete, flush)
|
|
85
|
+
- `ReferenceSyncBlockStoreManager` — Manages reference sync block state (fetch, subscribe, cache)
|
|
86
|
+
- `SyncBlockInMemorySessionCache` — Caches data for view→edit transitions
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Plugin Internals (`editor-plugin-synced-block/src/`)
|
|
91
|
+
|
|
92
|
+
The plugin follows a layered architecture:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
syncedBlockPlugin.tsx ← Top-level: registers nodes, commands, UI, pm-plugins
|
|
96
|
+
├── syncedBlockPluginType.ts ← TypeScript interfaces for options, shared state, dependencies
|
|
97
|
+
├── editor-commands/
|
|
98
|
+
│ └── index.ts ← createSyncedBlock, copySyncedBlockReferenceToClipboardEditorCommand,
|
|
99
|
+
│ removeSyncedBlockAtPos, unsyncSyncBlock
|
|
100
|
+
├── nodeviews/
|
|
101
|
+
│ ├── syncedBlock.tsx ← NodeView for reference (syncBlock) — read-only, fetches from BE
|
|
102
|
+
│ ├── bodiedSyncedBlock.tsx ← NodeView for source (bodiedSyncBlock) — nested editor with content
|
|
103
|
+
│ └── bodiedSyncBlockNodeWithToDOMFixed.ts ← DOM serialization fix variant (experiment-gated)
|
|
104
|
+
├── pm-plugins/
|
|
105
|
+
│ ├── main.ts ← Core state machine: sync block lifecycle, creation, deletion, cache
|
|
106
|
+
│ ├── menu-and-toolbar-experiences.ts ← Experience tracking for menu/toolbar interactions
|
|
107
|
+
│ └── utils/
|
|
108
|
+
│ ├── track-sync-blocks.ts ← Tracks mutations, updates shared state
|
|
109
|
+
│ ├── handle-bodied-sync-block-creation.ts ← Creation flow, local cache, retry logic
|
|
110
|
+
│ └── handle-bodied-sync-block-removal.ts ← Deletion flow, BE synchronization
|
|
111
|
+
├── ui/
|
|
112
|
+
│ ├── toolbar-components.tsx ← Primary toolbar button ("Create Synced Block")
|
|
113
|
+
│ ├── floating-toolbar.tsx ← Node-level actions: delete, unsync, copy link, view locations
|
|
114
|
+
│ ├── block-menu-components.tsx ← Block menu entry
|
|
115
|
+
│ ├── quick-insert.tsx ← Slash command / quick insert config
|
|
116
|
+
│ ├── DeleteConfirmationModal.tsx ← Deletion confirmation dialog
|
|
117
|
+
│ ├── SyncBlockRefresher.tsx ← Periodic data refresh from backend
|
|
118
|
+
│ └── Flag.tsx ← Error/info flags (offline, copy notifications)
|
|
119
|
+
└── types/
|
|
120
|
+
└── index.ts ← FLAG_ID, SyncedBlockSharedState, BodiedSyncBlockDeletionStatus
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Key Code Patterns
|
|
124
|
+
|
|
125
|
+
**Creating a sync block** (flow through the code):
|
|
126
|
+
1. User triggers via toolbar/block menu/slash command → `ui/toolbar-components.tsx` or `ui/block-menu-components.tsx`
|
|
127
|
+
2. Calls `editor-commands/createSyncedBlock` → inserts `bodiedSyncBlock` node into document
|
|
128
|
+
3. `pm-plugins/main.ts` detects new node → `handle-bodied-sync-block-creation.ts` → calls `SyncBlockStoreManager.create()` → Block Service API
|
|
129
|
+
4. `menu-and-toolbar-experiences.ts` fires experience event
|
|
130
|
+
|
|
131
|
+
**Reference rendering** (flow through the code):
|
|
132
|
+
1. `nodeviews/syncedBlock.tsx` mounts for each `syncBlock` node
|
|
133
|
+
2. Calls `ReferenceSyncBlockStoreManager.fetch(resourceId)` → Block Service API
|
|
134
|
+
3. Renders content via nested renderer from `editor-synced-block-renderer`
|
|
135
|
+
4. Subscribes to AGG WebSocket for real-time updates
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Common Tasks
|
|
140
|
+
|
|
141
|
+
### Implementing a new feature in sync blocks
|
|
142
|
+
|
|
143
|
+
1. **Identify scope**: Does it affect source, reference, or both? Editor, renderer, or both?
|
|
144
|
+
2. **Platform first**: Make changes in `editor-plugin-synced-block` or `editor-synced-block-provider`
|
|
145
|
+
3. **Product integration**: Update Confluence (`fabric-providers`) and/or Jira (`issue-view-synced-block-provider`)
|
|
146
|
+
4. **Feature gate**: Use a DnH **Experiment** (not a feature gate) for production changes. See [Experiment and gates page](https://hello.atlassian.net/wiki/spaces/egcuc/pages/6390978659)
|
|
147
|
+
5. **Analytics**: Add experience tracking events (see `EDITOR-1665` pattern)
|
|
148
|
+
6. **Test**: Add tests in the corresponding test package
|
|
149
|
+
|
|
150
|
+
### Fixing a bug
|
|
151
|
+
|
|
152
|
+
1. **Check supported node types**: [Edit at source](https://hello.atlassian.net/wiki/spaces/egcuc/pages/5926568979) | [Edit anywhere](https://hello.atlassian.net/wiki/spaces/egcuc/pages/5864526866)
|
|
153
|
+
2. **Check unsupported content handling**: [Unsupported content](https://hello.atlassian.net/wiki/spaces/egcuc/pages/5687277297)
|
|
154
|
+
3. **Debug with analytics**: [HOW-TO: Use analytics to debug errors](https://hello.atlassian.net/wiki/spaces/egcuc/pages/6342760320)
|
|
155
|
+
4. **Gate the fix**: Use DnH Experiment, not a feature gate
|
|
156
|
+
5. **Test on staging**: Verify on Hello (hello.atlassian.net) with experiment enabled
|
|
157
|
+
|
|
158
|
+
### Cleaning up a feature gate
|
|
159
|
+
|
|
160
|
+
1. Find the gate key in [Experiment and gates](https://hello.atlassian.net/wiki/spaces/egcuc/pages/6390978659)
|
|
161
|
+
2. Search codebase: `grep -r "gate_key_name" platform/ confluence/ jira/`
|
|
162
|
+
3. Remove conditional logic, keep the "enabled" code path
|
|
163
|
+
4. Remove the Switcheroo/Statsig configuration
|
|
164
|
+
5. Update the Confluence page to mark as "Cleaned up"
|
|
165
|
+
|
|
166
|
+
### Adding support for a new node type in sync blocks
|
|
167
|
+
|
|
168
|
+
1. Check if node is in the supported list: [Supported node types](https://hello.atlassian.net/wiki/spaces/egcuc/pages/5926568979)
|
|
169
|
+
2. For **source**: Update the allowed node schema in `editor-plugin-synced-block`
|
|
170
|
+
3. For **reference**: Ensure nested renderer in `editor-synced-block-renderer` can render the node
|
|
171
|
+
4. Test in both classic pages and live pages
|
|
172
|
+
5. Test in Jira issue description renderer
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Performance Considerations
|
|
177
|
+
|
|
178
|
+
- **VC90**: Sync blocks can regress VC90 due to content shift (CLS). Reference blocks fetch content
|
|
179
|
+
async and shift the page. Use SSR preloading to mitigate.
|
|
180
|
+
- **SSR**: Bulk fetch endpoint reduces waterfall. Configurable via `platform_editor_sync_block_ssr_config`.
|
|
181
|
+
- **View→Edit transition**: Cache sync block data in session storage (see `SyncBlockInMemorySessionCache`)
|
|
182
|
+
- **Criterion tests**: [Perf test page](https://hello.atlassian.net/wiki/spaces/egcuc/pages/6498888237)
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Analytics Events Quick Reference
|
|
187
|
+
|
|
188
|
+
**Experience events** (SLO-driving): `asyncOperation` type
|
|
189
|
+
- `fetchSyncedBlock`, `fetchSyncedBlockSourceInfo`, `fetchSyncedBlockReferencesInfo`
|
|
190
|
+
- `syncedBlockCreate`, `syncedBlockUpdate`, `syncedBlockDelete`
|
|
191
|
+
- `referenceSyncedBlockUpdate`
|
|
192
|
+
|
|
193
|
+
**Menu/toolbar events**: `menuAction` and `toolbarAction` types
|
|
194
|
+
- `syncedBlockCreate` (quickInsertMenu, blockMenu, primaryToolbar)
|
|
195
|
+
- `syncedBlockDelete`, `referenceSyncedBlockDelete` (syncedBlockToolbar)
|
|
196
|
+
- `syncedBlockUnsync`, `referenceSyncedBlockUnsync` (syncedBlockToolbar)
|
|
197
|
+
- `syncedBlockViewLocations`, `syncedBlockEditSource` (syncedBlockToolbar)
|
|
198
|
+
|
|
199
|
+
**Standard analytics events**: Track individual sync block operations
|
|
200
|
+
- `fetched/fetchSyncedBlock` — attributes: `resourceId`, `blockInstanceId`, `sourceProduct`
|
|
201
|
+
- `rendered/renderSyncedBlock` — attributes: `resourceId`, `sourceProduct`, state (`loaded`/`error`/`permissionDenied`/`missingSource`)
|
|
202
|
+
- `inserted/documentInserted` (page save) — attributes: `numberOfSyncedBlocks`, `numberOfReferencedSyncedBlocks`
|
|
203
|
+
|
|
204
|
+
Full catalogue: [Synced Block Analytics Catalogue](https://hello.atlassian.net/wiki/spaces/egcuc/pages/6332253480)
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Key Jira Queries
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
# All synced block tickets
|
|
212
|
+
"Epic Link" in (EDITOR-1519, EDITOR-2441, EDITOR-1783, EDITOR-3936, EDITOR-3586, EDITOR-5010)
|
|
213
|
+
|
|
214
|
+
# Open bugs
|
|
215
|
+
... AND type = Bug AND status not in (Done, "Won't do") ORDER BY priority DESC
|
|
216
|
+
|
|
217
|
+
# M2 (Jira source creation)
|
|
218
|
+
"Epic Link" = EDITOR-5010 ORDER BY created DESC
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Key Confluence Pages
|
|
224
|
+
|
|
225
|
+
- **Architecture**: https://hello.atlassian.net/wiki/spaces/egcuc/pages/5505188521
|
|
226
|
+
- **Implementation view**: https://hello.atlassian.net/wiki/spaces/egcuc/pages/5997083214
|
|
227
|
+
- **Decisions record**: https://hello.atlassian.net/wiki/spaces/egcuc/pages/5882558842
|
|
228
|
+
- **Feature flags**: https://hello.atlassian.net/wiki/spaces/egcuc/pages/6390978659
|
|
229
|
+
- **Analytics catalogue**: https://hello.atlassian.net/wiki/spaces/egcuc/pages/6332253480
|
|
230
|
+
- **Debug errors HOW-TO**: https://hello.atlassian.net/wiki/spaces/egcuc/pages/6342760320
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Slack Channels
|
|
235
|
+
|
|
236
|
+
- **Engineering**: https://atlassian.enterprise.slack.com/archives/C09DZT1TBNW
|
|
237
|
+
- **Product & Design**: https://atlassian.enterprise.slack.com/archives/C091Y69RBGU
|
|
238
|
+
- **M2 / Jira**: https://atlassian.enterprise.slack.com/archives/C09RS7JCBED
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-synced-block
|
|
2
2
|
|
|
3
|
+
## 6.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`3895f6d32cc49`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3895f6d32cc49) -
|
|
8
|
+
Set hasReceivedContentChange on successful sync block creation to ensure unsaved changes are
|
|
9
|
+
flushed
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 6.0.16
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -172,7 +172,8 @@ var toDOM = function toDOM(node) {
|
|
|
172
172
|
};
|
|
173
173
|
var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
174
174
|
function BodiedSyncBlock(node, view, getPos, api, nodeViewPortalProviderAPI, syncBlockStore) {
|
|
175
|
-
var _this4 = this
|
|
175
|
+
var _this4 = this,
|
|
176
|
+
_this$syncedBlockStor;
|
|
176
177
|
(0, _classCallCheck2.default)(this, BodiedSyncBlock);
|
|
177
178
|
this.node = node;
|
|
178
179
|
this.view = view;
|
|
@@ -203,6 +204,9 @@ var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
203
204
|
this.updateContentEditable({});
|
|
204
205
|
this.handleConnectivityModeChange();
|
|
205
206
|
this.handleViewModeChange();
|
|
207
|
+
|
|
208
|
+
// update sync block data on initial creation
|
|
209
|
+
(_this$syncedBlockStor = this.syncedBlockStore) === null || _this$syncedBlockStor === void 0 || _this$syncedBlockStor.sourceManager.updateSyncBlockData(node);
|
|
206
210
|
}
|
|
207
211
|
return (0, _createClass2.default)(BodiedSyncBlock, [{
|
|
208
212
|
key: "updateContentEditable",
|
|
@@ -245,6 +249,12 @@ var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
245
249
|
});
|
|
246
250
|
}
|
|
247
251
|
}
|
|
252
|
+
}, {
|
|
253
|
+
key: "syncedBlockStore",
|
|
254
|
+
get: function get() {
|
|
255
|
+
var _this$api$syncedBlock2, _this$api1;
|
|
256
|
+
return (_this$api$syncedBlock2 = (_this$api1 = this.api) === null || _this$api1 === void 0 || (_this$api1 = _this$api1.syncedBlock.sharedState) === null || _this$api1 === void 0 || (_this$api1 = _this$api1.currentState()) === null || _this$api1 === void 0 ? void 0 : _this$api1.syncBlockStore) !== null && _this$api$syncedBlock2 !== void 0 ? _this$api$syncedBlock2 : this.syncBlockStore;
|
|
257
|
+
}
|
|
248
258
|
}, {
|
|
249
259
|
key: "update",
|
|
250
260
|
value: function update(node) {
|
|
@@ -252,9 +262,8 @@ var BodiedSyncBlock = exports.BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
252
262
|
return false;
|
|
253
263
|
}
|
|
254
264
|
if (node !== this.node) {
|
|
255
|
-
var _this$
|
|
256
|
-
|
|
257
|
-
syncBlockStore === null || syncBlockStore === void 0 || syncBlockStore.sourceManager.updateSyncBlockData(node);
|
|
265
|
+
var _this$syncedBlockStor2;
|
|
266
|
+
(_this$syncedBlockStor2 = this.syncedBlockStore) === null || _this$syncedBlockStor2 === void 0 || _this$syncedBlockStor2.sourceManager.updateSyncBlockData(node);
|
|
258
267
|
}
|
|
259
268
|
this.node = node;
|
|
260
269
|
return true;
|
|
@@ -138,6 +138,7 @@ const toDOM = node => ['div', {
|
|
|
138
138
|
}, 0]];
|
|
139
139
|
export class BodiedSyncBlock {
|
|
140
140
|
constructor(node, view, getPos, api, nodeViewPortalProviderAPI, syncBlockStore) {
|
|
141
|
+
var _this$syncedBlockStor;
|
|
141
142
|
this.node = node;
|
|
142
143
|
this.view = view;
|
|
143
144
|
this.getPos = getPos;
|
|
@@ -168,6 +169,9 @@ export class BodiedSyncBlock {
|
|
|
168
169
|
this.updateContentEditable({});
|
|
169
170
|
this.handleConnectivityModeChange();
|
|
170
171
|
this.handleViewModeChange();
|
|
172
|
+
|
|
173
|
+
// update sync block data on initial creation
|
|
174
|
+
(_this$syncedBlockStor = this.syncedBlockStore) === null || _this$syncedBlockStor === void 0 ? void 0 : _this$syncedBlockStor.sourceManager.updateSyncBlockData(node);
|
|
171
175
|
}
|
|
172
176
|
updateContentEditable({
|
|
173
177
|
nextConnectivityMode,
|
|
@@ -205,14 +209,17 @@ export class BodiedSyncBlock {
|
|
|
205
209
|
});
|
|
206
210
|
}
|
|
207
211
|
}
|
|
212
|
+
get syncedBlockStore() {
|
|
213
|
+
var _this$api$syncedBlock2, _this$api10, _this$api10$syncedBlo, _this$api10$syncedBlo2;
|
|
214
|
+
return (_this$api$syncedBlock2 = (_this$api10 = this.api) === null || _this$api10 === void 0 ? void 0 : (_this$api10$syncedBlo = _this$api10.syncedBlock.sharedState) === null || _this$api10$syncedBlo === void 0 ? void 0 : (_this$api10$syncedBlo2 = _this$api10$syncedBlo.currentState()) === null || _this$api10$syncedBlo2 === void 0 ? void 0 : _this$api10$syncedBlo2.syncBlockStore) !== null && _this$api$syncedBlock2 !== void 0 ? _this$api$syncedBlock2 : this.syncBlockStore;
|
|
215
|
+
}
|
|
208
216
|
update(node) {
|
|
209
217
|
if (this.node.type !== node.type) {
|
|
210
218
|
return false;
|
|
211
219
|
}
|
|
212
220
|
if (node !== this.node) {
|
|
213
|
-
var _this$
|
|
214
|
-
|
|
215
|
-
syncBlockStore === null || syncBlockStore === void 0 ? void 0 : syncBlockStore.sourceManager.updateSyncBlockData(node);
|
|
221
|
+
var _this$syncedBlockStor2;
|
|
222
|
+
(_this$syncedBlockStor2 = this.syncedBlockStore) === null || _this$syncedBlockStor2 === void 0 ? void 0 : _this$syncedBlockStor2.sourceManager.updateSyncBlockData(node);
|
|
216
223
|
}
|
|
217
224
|
this.node = node;
|
|
218
225
|
return true;
|
|
@@ -165,7 +165,8 @@ var toDOM = function toDOM(node) {
|
|
|
165
165
|
};
|
|
166
166
|
export var BodiedSyncBlock = /*#__PURE__*/function () {
|
|
167
167
|
function BodiedSyncBlock(node, view, getPos, api, nodeViewPortalProviderAPI, syncBlockStore) {
|
|
168
|
-
var _this4 = this
|
|
168
|
+
var _this4 = this,
|
|
169
|
+
_this$syncedBlockStor;
|
|
169
170
|
_classCallCheck(this, BodiedSyncBlock);
|
|
170
171
|
this.node = node;
|
|
171
172
|
this.view = view;
|
|
@@ -196,6 +197,9 @@ export var BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
196
197
|
this.updateContentEditable({});
|
|
197
198
|
this.handleConnectivityModeChange();
|
|
198
199
|
this.handleViewModeChange();
|
|
200
|
+
|
|
201
|
+
// update sync block data on initial creation
|
|
202
|
+
(_this$syncedBlockStor = this.syncedBlockStore) === null || _this$syncedBlockStor === void 0 || _this$syncedBlockStor.sourceManager.updateSyncBlockData(node);
|
|
199
203
|
}
|
|
200
204
|
return _createClass(BodiedSyncBlock, [{
|
|
201
205
|
key: "updateContentEditable",
|
|
@@ -238,6 +242,12 @@ export var BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
238
242
|
});
|
|
239
243
|
}
|
|
240
244
|
}
|
|
245
|
+
}, {
|
|
246
|
+
key: "syncedBlockStore",
|
|
247
|
+
get: function get() {
|
|
248
|
+
var _this$api$syncedBlock2, _this$api1;
|
|
249
|
+
return (_this$api$syncedBlock2 = (_this$api1 = this.api) === null || _this$api1 === void 0 || (_this$api1 = _this$api1.syncedBlock.sharedState) === null || _this$api1 === void 0 || (_this$api1 = _this$api1.currentState()) === null || _this$api1 === void 0 ? void 0 : _this$api1.syncBlockStore) !== null && _this$api$syncedBlock2 !== void 0 ? _this$api$syncedBlock2 : this.syncBlockStore;
|
|
250
|
+
}
|
|
241
251
|
}, {
|
|
242
252
|
key: "update",
|
|
243
253
|
value: function update(node) {
|
|
@@ -245,9 +255,8 @@ export var BodiedSyncBlock = /*#__PURE__*/function () {
|
|
|
245
255
|
return false;
|
|
246
256
|
}
|
|
247
257
|
if (node !== this.node) {
|
|
248
|
-
var _this$
|
|
249
|
-
|
|
250
|
-
syncBlockStore === null || syncBlockStore === void 0 || syncBlockStore.sourceManager.updateSyncBlockData(node);
|
|
258
|
+
var _this$syncedBlockStor2;
|
|
259
|
+
(_this$syncedBlockStor2 = this.syncedBlockStore) === null || _this$syncedBlockStor2 === void 0 || _this$syncedBlockStor2.sourceManager.updateSyncBlockData(node);
|
|
251
260
|
}
|
|
252
261
|
this.node = node;
|
|
253
262
|
return true;
|
|
@@ -40,6 +40,7 @@ export declare class BodiedSyncBlock implements NodeView {
|
|
|
40
40
|
private updateContentEditable;
|
|
41
41
|
private handleConnectivityModeChange;
|
|
42
42
|
private handleViewModeChange;
|
|
43
|
+
private get syncedBlockStore();
|
|
43
44
|
update(node: PMNode): boolean;
|
|
44
45
|
ignoreMutation(mutation: MutationRecord | {
|
|
45
46
|
target: Node;
|
|
@@ -40,6 +40,7 @@ export declare class BodiedSyncBlock implements NodeView {
|
|
|
40
40
|
private updateContentEditable;
|
|
41
41
|
private handleConnectivityModeChange;
|
|
42
42
|
private handleViewModeChange;
|
|
43
|
+
private get syncedBlockStore();
|
|
43
44
|
update(node: PMNode): boolean;
|
|
44
45
|
ignoreMutation(mutation: MutationRecord | {
|
|
45
46
|
target: Node;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-synced-block",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.17",
|
|
4
4
|
"description": "SyncedBlock plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
55
55
|
"@atlaskit/primitives": "^18.0.0",
|
|
56
56
|
"@atlaskit/spinner": "19.0.11",
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
57
|
+
"@atlaskit/tmp-editor-statsig": "^42.0.0",
|
|
58
58
|
"@atlaskit/tokens": "11.1.1",
|
|
59
59
|
"@atlaskit/tooltip": "^21.0.0",
|
|
60
60
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@atlaskit/editor-common": "^112.
|
|
68
|
+
"@atlaskit/editor-common": "^112.7.0",
|
|
69
69
|
"react": "^18.2.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|