@atlaskit/editor-plugin-local-id 6.0.21 → 6.0.22
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/CHANGELOG.md +8 -0
- package/README.md +49 -13
- package/docs/0-intro.tsx +55 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-local-id
|
|
2
2
|
|
|
3
|
+
## 6.0.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`14803a836f641`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/14803a836f641) -
|
|
8
|
+
Update README.md and 0-intro.tsx
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 6.0.21
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,43 +1,57 @@
|
|
|
1
|
-
# Editor Plugin
|
|
1
|
+
# Editor Plugin Local ID
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
LocalId plugin for @atlaskit/editor-core
|
|
4
4
|
|
|
5
|
-
This
|
|
5
|
+
**Note:** This component is designed for internal Atlassian development. External contributors will be able to use this component but will not be able to submit issues.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
The Local ID plugin ensures that all non-ignored nodes in the document have unique `localId` attributes. It combines two approaches for optimal performance:
|
|
6
10
|
|
|
7
11
|
1. **One-time initialization scan** - Adds missing local IDs to existing nodes when the editor starts
|
|
8
12
|
2. **Incremental transaction processing** - Adds local IDs to new nodes as they're created
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
## Key features
|
|
15
|
+
|
|
16
|
+
- **Automatic local ID assignment** - Ensures all nodes without local IDs receive unique identifiers
|
|
17
|
+
- **Efficient initialization** - Uses `requestIdleCallback` with `requestAnimationFrame` fallback for Safari
|
|
18
|
+
- **Incremental updates** - Processes only changed nodes during transactions
|
|
19
|
+
- **Node filtering** - Skips ignored node types (text, hardBreak, mediaGroup)
|
|
20
|
+
- **Batch processing** - Applies all updates in a single transaction
|
|
21
|
+
- **Error tracking** - Optional error reporting for local ID changes via watchmen plugin
|
|
22
|
+
- **Plugin actions** - Provides `getNode` and `replaceNode` actions for querying and modifying nodes by local ID
|
|
11
23
|
|
|
12
|
-
|
|
24
|
+
### How It Works
|
|
25
|
+
|
|
26
|
+
#### Initialization Phase
|
|
13
27
|
|
|
14
|
-
### Initialization Phase
|
|
15
28
|
- **Trigger**: Uses the editor view's initialization lifecycle to schedule the scan
|
|
16
29
|
- **Execution**: Performs a single document traversal during browser idle time
|
|
17
30
|
- **Scheduling**: Uses `requestIdleCallback` with `requestAnimationFrame` fallback for Safari
|
|
18
31
|
- **Purpose**: Ensures all existing nodes have local IDs
|
|
19
32
|
|
|
20
|
-
|
|
33
|
+
#### Transaction Processing Phase
|
|
34
|
+
|
|
21
35
|
- **Trigger**: Activates on every document-changing transaction
|
|
22
36
|
- **Execution**: Processes only the new/changed nodes from transaction steps
|
|
23
37
|
- **Performance**: Only scans changed ranges, not the entire document
|
|
24
38
|
- **Purpose**: Adds local IDs to newly created nodes
|
|
25
39
|
|
|
26
|
-
|
|
40
|
+
#### Node Processing
|
|
41
|
+
|
|
27
42
|
For each node (both during initialization and transaction processing):
|
|
28
43
|
- **Ignored nodes**: Always skipped (text, hardBreak)
|
|
29
44
|
- **Nodes with existing localId**: Left unchanged
|
|
30
45
|
- **Nodes without localId**: New UUID generated and assigned
|
|
31
46
|
|
|
32
|
-
|
|
47
|
+
#### Transaction Handling
|
|
48
|
+
|
|
33
49
|
- **Incremental updates**: Only processes nodes that actually changed
|
|
34
50
|
- **Efficient scanning**: Uses `step.getMap()` to identify changed ranges
|
|
35
51
|
- **Position accuracy**: Gets precise document positions for all changed nodes
|
|
36
52
|
- **Batch processing**: All updates applied in a single transaction
|
|
37
53
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
## ✅ Behavior
|
|
54
|
+
#### Behavior
|
|
41
55
|
|
|
42
56
|
| Case | Action Taken | Transaction Impact |
|
|
43
57
|
|------|-------------|-------------------|
|
|
@@ -48,5 +62,27 @@ For each node (both during initialization and transaction processing):
|
|
|
48
62
|
| Cut operations | Skipped to avoid conflicts | No transaction |
|
|
49
63
|
| Document unchanged | Early exit | No transaction |
|
|
50
64
|
|
|
51
|
-
|
|
65
|
+
## Install
|
|
66
|
+
|
|
67
|
+
- **Install** - *yarn add @atlaskit/editor-plugin-local-id*
|
|
68
|
+
- **npm** - [@atlaskit/editor-plugin-local-id](https://www.npmjs.com/package/@atlaskit/editor-plugin-local-id)
|
|
69
|
+
- **Source** - [Bitbucket](https://bitbucket.org/atlassian/atlassian-frontend/src/master/packages/editor/editor-plugin-local-id)
|
|
70
|
+
- **Bundle** - [unpkg.com](https://unpkg.com/@atlaskit/editor-plugin-local-id/dist/)
|
|
71
|
+
|
|
72
|
+
## Usage
|
|
73
|
+
|
|
74
|
+
**Internal use only**
|
|
75
|
+
|
|
76
|
+
@atlaskit/editor-plugin-local-id is intended for internal use by the @atlaskit/editor-core and as a plugin dependency of the Editor within your product.
|
|
77
|
+
|
|
78
|
+
Direct use of this component is not supported.
|
|
79
|
+
|
|
80
|
+
Please see [Atlaskit - Editor plugin local-id](https://atlaskit.atlassian.com/packages/editor/editor-plugin-local-id) for documentation and examples for this package.
|
|
81
|
+
|
|
82
|
+
## Support
|
|
83
|
+
|
|
84
|
+
For internal Atlassian, visit the slack channel [#help-editor](https://atlassian.slack.com/archives/CFG3PSQ9E) for support or visit [go/editor-help](https://go/editor-help) to submit a bug.
|
|
85
|
+
|
|
86
|
+
## License
|
|
52
87
|
|
|
88
|
+
Please see [Atlassian Frontend - License](https://hello.atlassian.net/wiki/spaces/AF/pages/2589099144/Documentation#License) for more licensing information.
|
package/docs/0-intro.tsx
CHANGED
|
@@ -31,7 +31,61 @@ The \`dependencies\`, \`configuration\`, \`state\`, \`actions\`, and \`commands\
|
|
|
31
31
|
below:
|
|
32
32
|
|
|
33
33
|
${code`
|
|
34
|
-
type
|
|
34
|
+
export type ActionProps = {
|
|
35
|
+
localId: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type LocalIdStatusCode =
|
|
39
|
+
| 'current'
|
|
40
|
+
| 'localChangeByAttr'
|
|
41
|
+
| 'localChangeBySetAttrs'
|
|
42
|
+
| 'localChangeByBatchAttrs'
|
|
43
|
+
| 'localChangeByReplace'
|
|
44
|
+
| 'localChangeByDelete'
|
|
45
|
+
| 'localChangeByReplaceAround'
|
|
46
|
+
| 'localChangeByUnknown'
|
|
47
|
+
| 'remoteChangeByAttr'
|
|
48
|
+
| 'remoteChangeBySetAttrs'
|
|
49
|
+
| 'remoteChangeByBatchAttrs'
|
|
50
|
+
| 'remoteChangeByReplace'
|
|
51
|
+
| 'remoteChangeByDelete'
|
|
52
|
+
| 'remoteChangeByReplaceAround'
|
|
53
|
+
| 'remoteChangeByUnknown'
|
|
54
|
+
| 'AIChangeByAttr'
|
|
55
|
+
| 'AIChangeBySetAttrs'
|
|
56
|
+
| 'AIChangeByBatchAttrs'
|
|
57
|
+
| 'AIChangeByReplace'
|
|
58
|
+
| 'AIChangeByDelete'
|
|
59
|
+
| 'AIChangeByReplaceAround'
|
|
60
|
+
| 'AIChangeByUnknown'
|
|
61
|
+
| 'docChangeByAttr'
|
|
62
|
+
| 'docChangeBySetAttrs'
|
|
63
|
+
| 'docChangeByBatchAttrs'
|
|
64
|
+
| 'docChangeByReplace'
|
|
65
|
+
| 'docChangeByDelete'
|
|
66
|
+
| 'docChangeByReplaceAround'
|
|
67
|
+
| 'docChangeByUnknown';
|
|
68
|
+
|
|
69
|
+
export interface LocalIdSharedState {
|
|
70
|
+
localIdStatus: Map<string, LocalIdStatusCode> | undefined;
|
|
71
|
+
localIdWatchmenEnabled: boolean | undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type LocalIdPlugin = NextEditorPlugin<
|
|
75
|
+
'localId',
|
|
76
|
+
{
|
|
77
|
+
actions: {
|
|
78
|
+
getNode: (props: ActionProps) => NodeWithPos | undefined;
|
|
79
|
+
replaceNode: (props: ActionProps & { value: Node }) => boolean;
|
|
80
|
+
};
|
|
81
|
+
dependencies: [
|
|
82
|
+
CompositionPlugin,
|
|
83
|
+
OptionalPlugin<CollabEditPlugin>,
|
|
84
|
+
OptionalPlugin<LimitedModePlugin>,
|
|
85
|
+
];
|
|
86
|
+
sharedState: LocalIdSharedState | undefined;
|
|
87
|
+
}
|
|
88
|
+
>;
|
|
35
89
|
`}
|
|
36
90
|
|
|
37
91
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-local-id",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.22",
|
|
4
4
|
"description": "LocalId plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@atlaskit/editor-plugin-limited-mode": "^5.0.0",
|
|
35
35
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
36
36
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
37
|
-
"@atlaskit/tmp-editor-statsig": "^55.
|
|
37
|
+
"@atlaskit/tmp-editor-statsig": "^55.1.0",
|
|
38
38
|
"@babel/runtime": "^7.0.0",
|
|
39
39
|
"raf-schd": "^4.0.3"
|
|
40
40
|
},
|