@atlaskit/editor-core 193.24.6 → 193.24.18
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/.eslintrc.js +37 -37
- package/CHANGELOG.md +16 -0
- package/architecture/0001-record-architecture-decisions.md +6 -3
- package/architecture/0002-deep-equality-check-for-getsharedstate.md +9 -8
- package/architecture/0003-explicit-plugin-dependencies.md +47 -18
- package/codemods/140.0.0-rc-kraken-fix-type-errors.ts +1 -3
- package/codemods/145.0.0-deprecate-props.ts +1 -3
- package/codemods/172.0.0-transform-smartlinks-prop.ts +1 -3
- package/codemods/175.0.0-rename-unsafe-allowUndoRedoButton-prop.ts +1 -1
- package/codemods/180.1.0-update-to-editor-migration-component.ts +1 -3
- package/codemods/__tests__/next-remove-allow-more-text-colors-prop.ts +29 -31
- package/codemods/__tests__/remove-config-panel-width-prop.ts +29 -31
- package/codemods/__tests__/rename-editor-to-editor-migration-component.ts +43 -45
- package/codemods/__tests__/rename-smartlinks-prop.ts +57 -59
- package/codemods/__tests__/rename-unsafe-allowUndoRedoButtons-prop.ts +43 -43
- package/codemods/__tests__/rename-unsafe-cards-prop.ts +43 -45
- package/codemods/migrates/next-remove-allow-more-text-colors-prop.ts +41 -45
- package/codemods/migrates/remove-config-panel-width-prop.ts +20 -29
- package/codemods/migrates/rename-editor-to-editor-migration-component.ts +20 -24
- package/codemods/migrates/rename-smartlinks-prop.ts +30 -38
- package/codemods/migrates/rename-unsafe-allowUndoRedoButtons-prop.ts +4 -5
- package/codemods/migrates/rename-unsafe-cards-prop.ts +1 -4
- package/codemods/utils.ts +62 -72
- package/dist/cjs/ui/Appearance/Comment/Toolbar.js +3 -3
- package/dist/cjs/ui/AppearanceComponents/Mobile.js +5 -5
- package/dist/cjs/ui/ContentStyles/ai-panels.js +1 -1
- package/dist/cjs/ui/ContentStyles/code-block.js +2 -2
- package/dist/cjs/ui/ContentStyles/date.js +1 -1
- package/dist/cjs/ui/ContentStyles/expand.js +1 -1
- package/dist/cjs/ui/ContentStyles/extension.js +2 -2
- package/dist/cjs/ui/ContentStyles/index.js +6 -6
- package/dist/cjs/ui/ContentStyles/layout.js +1 -1
- package/dist/cjs/ui/ContentStyles/media.js +1 -1
- package/dist/cjs/ui/ContentStyles/panel.js +1 -1
- package/dist/cjs/ui/ContentStyles/status.js +1 -1
- package/dist/cjs/ui/ContentStyles/tasks-and-decisions.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/ui/Appearance/Comment/Toolbar.js +40 -40
- package/dist/es2019/ui/AppearanceComponents/Mobile.js +5 -5
- package/dist/es2019/ui/ContentStyles/ai-panels.js +80 -80
- package/dist/es2019/ui/ContentStyles/code-block.js +58 -58
- package/dist/es2019/ui/ContentStyles/date.js +19 -19
- package/dist/es2019/ui/ContentStyles/expand.js +98 -98
- package/dist/es2019/ui/ContentStyles/extension.js +154 -159
- package/dist/es2019/ui/ContentStyles/index.js +139 -144
- package/dist/es2019/ui/ContentStyles/layout.js +125 -125
- package/dist/es2019/ui/ContentStyles/media.js +179 -178
- package/dist/es2019/ui/ContentStyles/panel.js +29 -30
- package/dist/es2019/ui/ContentStyles/status.js +30 -32
- package/dist/es2019/ui/ContentStyles/tasks-and-decisions.js +18 -19
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/ui/Appearance/Comment/Toolbar.js +3 -3
- package/dist/esm/ui/AppearanceComponents/Mobile.js +5 -5
- package/dist/esm/ui/ContentStyles/ai-panels.js +1 -1
- package/dist/esm/ui/ContentStyles/code-block.js +2 -2
- package/dist/esm/ui/ContentStyles/date.js +1 -1
- package/dist/esm/ui/ContentStyles/expand.js +1 -1
- package/dist/esm/ui/ContentStyles/extension.js +2 -2
- package/dist/esm/ui/ContentStyles/index.js +6 -6
- package/dist/esm/ui/ContentStyles/layout.js +1 -1
- package/dist/esm/ui/ContentStyles/media.js +1 -1
- package/dist/esm/ui/ContentStyles/panel.js +1 -1
- package/dist/esm/ui/ContentStyles/status.js +1 -1
- package/dist/esm/ui/ContentStyles/tasks-and-decisions.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/composable-editor/editor.d.ts +1 -1
- package/dist/types/composable-editor/hooks/useProviders.d.ts +1 -1
- package/dist/types/create-editor/create-preset.d.ts +135 -9
- package/dist/types/create-editor/sort-by-order.d.ts +1 -1
- package/dist/types/event-dispatcher/index.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/presets/default.d.ts +120 -8
- package/dist/types/presets/universal.d.ts +135 -9
- package/dist/types/presets/useUniversalPreset.d.ts +135 -9
- package/dist/types/test-utils.d.ts +1 -1
- package/dist/types/types/browser.d.ts +1 -1
- package/dist/types/types/editor-plugin.d.ts +1 -1
- package/dist/types/types/empty-state-handler.d.ts +1 -1
- package/dist/types/types/feature-flags.d.ts +1 -1
- package/dist/types/types/index.d.ts +3 -3
- package/dist/types/types/pm-config.d.ts +1 -1
- package/dist/types/types/ui-components.d.ts +1 -1
- package/dist/types/ui/Addon/ClickAreaBlock/index.d.ts +1 -1
- package/dist/types/ui/Toolbar/types.d.ts +1 -1
- package/dist/types/utils/action.d.ts +1 -4
- package/dist/types/utils/performance/plugin-performance-report.d.ts +1 -1
- package/dist/types/utils/slice.d.ts +1 -1
- package/dist/types-ts4.5/composable-editor/editor.d.ts +1 -1
- package/dist/types-ts4.5/composable-editor/hooks/useProviders.d.ts +1 -1
- package/dist/types-ts4.5/create-editor/create-preset.d.ts +153 -9
- package/dist/types-ts4.5/create-editor/sort-by-order.d.ts +1 -1
- package/dist/types-ts4.5/event-dispatcher/index.d.ts +2 -2
- package/dist/types-ts4.5/index.d.ts +2 -2
- package/dist/types-ts4.5/presets/default.d.ts +136 -8
- package/dist/types-ts4.5/presets/universal.d.ts +153 -9
- package/dist/types-ts4.5/presets/useUniversalPreset.d.ts +153 -9
- package/dist/types-ts4.5/test-utils.d.ts +1 -1
- package/dist/types-ts4.5/types/browser.d.ts +1 -1
- package/dist/types-ts4.5/types/editor-plugin.d.ts +1 -1
- package/dist/types-ts4.5/types/empty-state-handler.d.ts +1 -1
- package/dist/types-ts4.5/types/feature-flags.d.ts +1 -1
- package/dist/types-ts4.5/types/index.d.ts +3 -3
- package/dist/types-ts4.5/types/pm-config.d.ts +1 -1
- package/dist/types-ts4.5/types/ui-components.d.ts +1 -1
- package/dist/types-ts4.5/ui/Addon/ClickAreaBlock/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/Toolbar/types.d.ts +1 -1
- package/dist/types-ts4.5/utils/performance/plugin-performance-report.d.ts +1 -1
- package/dist/types-ts4.5/utils/slice.d.ts +1 -1
- package/docs/0-intro.tsx +13 -19
- package/docs/1-legacy-editor.tsx +13 -19
- package/docs/4-annotations.tsx +222 -223
- package/package.json +25 -16
- package/report.api.md +448 -473
package/.eslintrc.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
2
|
+
rules: {
|
|
3
|
+
'@atlaskit/design-system/ensure-design-token-usage/preview': [
|
|
4
|
+
'error',
|
|
5
|
+
{ domains: ['spacing'], shouldEnforceFallbacks: false },
|
|
6
|
+
],
|
|
7
|
+
'import/no-restricted-paths': [
|
|
8
|
+
'warn',
|
|
9
|
+
{
|
|
10
|
+
zones: [
|
|
11
|
+
{
|
|
12
|
+
target: 'packages/editor/editor-core/src/**/*',
|
|
13
|
+
from: `packages/editor/editor-core/src/plugins/*/!(types)*`,
|
|
14
|
+
message:
|
|
15
|
+
'[ELR101] Avoid importing dependencies from editor plugins. Type-only imports are an exception. Move shared code to a common location. go/elr101',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
target: 'packages/editor/editor-core/src/**/*',
|
|
19
|
+
from: `packages/editor/editor-core/src/plugins/*/!(types)**/*`,
|
|
20
|
+
message:
|
|
21
|
+
'[ELR101] Avoid importing dependencies from editor plugins. Type-only imports are an exception. Move shared code to a common location. go/elr101',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
overrides: [
|
|
28
|
+
{
|
|
29
|
+
files: [
|
|
30
|
+
'**/__tests__/**/*.{js,ts,tsx}',
|
|
31
|
+
'examples/**/*.{js,ts,tsx}',
|
|
32
|
+
'**/*.{test,spec}.{js,ts,tsx}',
|
|
33
|
+
],
|
|
34
|
+
rules: {
|
|
35
|
+
'import/no-restricted-paths': ['off'],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
39
|
};
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 193.24.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#107335](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107335)
|
|
8
|
+
[`d5457c8afe5f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d5457c8afe5f) -
|
|
9
|
+
Cleaned up FF platform.editor.media.autoselect-inserted-image_oumto
|
|
10
|
+
|
|
11
|
+
## 193.24.15
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#105930](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105930)
|
|
16
|
+
[`939b873db211`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/939b873db211) -
|
|
17
|
+
[ux] Sets increased table scaling percent when FF is enabled.
|
|
18
|
+
|
|
3
19
|
## 193.24.6
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -16,10 +16,13 @@ As a mechanism for a more "lightweight" RFC approach for smaller decisions.
|
|
|
16
16
|
|
|
17
17
|
Scope could also include larger ones summarised once an RFC/DACI might be accepted.
|
|
18
18
|
|
|
19
|
-
Some of the dates will be backdated to port/transfer over some of the decisions from our decision
|
|
19
|
+
Some of the dates will be backdated to port/transfer over some of the decisions from our decision
|
|
20
|
+
log/registry.
|
|
20
21
|
|
|
21
|
-
We will use Architecture Decision Records, as
|
|
22
|
+
We will use Architecture Decision Records, as
|
|
23
|
+
[described by Michael Nygard](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions).
|
|
22
24
|
|
|
23
25
|
## Consequences
|
|
24
26
|
|
|
25
|
-
See Michael Nygard's article, linked above. For a lightweight ADR toolset, see Nat Pryce's
|
|
27
|
+
See Michael Nygard's article, linked above. For a lightweight ADR toolset, see Nat Pryce's
|
|
28
|
+
[adr-tools](https://github.com/npryce/adr-tools).
|
|
@@ -12,7 +12,8 @@ via @Rodrigo Vieira https://atlassian.slack.com/archives/C046RBH9HT5/p1679018928
|
|
|
12
12
|
|
|
13
13
|
People, we have a optimisation situation with the getSharedState.
|
|
14
14
|
|
|
15
|
-
Right now, it is expect to be a pure function, That means return the same value for the same input,
|
|
15
|
+
Right now, it is expect to be a pure function, That means return the same value for the same input,
|
|
16
|
+
but you could do something like that
|
|
16
17
|
|
|
17
18
|
```ts
|
|
18
19
|
getSharedState(editorState) {
|
|
@@ -33,11 +34,9 @@ Right we are doing a shallow check before call the onChange listeners:
|
|
|
33
34
|
```ts
|
|
34
35
|
// Dumb check - should we do a deepcheck?
|
|
35
36
|
if (isInitialization || prevSharedState !== nextSharedState) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
);
|
|
40
|
-
});
|
|
37
|
+
(listeners.get(pluginName) || new Set<Callback>()).forEach((callback) => {
|
|
38
|
+
callbacks.push(callback.bind(callback, { nextSharedState, prevSharedState }));
|
|
39
|
+
});
|
|
41
40
|
}
|
|
42
41
|
```
|
|
43
42
|
|
|
@@ -50,7 +49,8 @@ We have two possible approaches
|
|
|
50
49
|
|
|
51
50
|
### Same as ProseMirror does
|
|
52
51
|
|
|
53
|
-
We can give the last shared state to the getSharedState and the dev would be responsible to return
|
|
52
|
+
We can give the last shared state to the getSharedState and the dev would be responsible to return
|
|
53
|
+
the same object in case there is no change
|
|
54
54
|
|
|
55
55
|
### Do a deep check
|
|
56
56
|
|
|
@@ -64,4 +64,5 @@ See https://bitbucket.org/%7B%7D/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull
|
|
|
64
64
|
|
|
65
65
|
## Consequences
|
|
66
66
|
|
|
67
|
-
Slight additional performance cost incurred, trading off for safety against plugins having to do the
|
|
67
|
+
Slight additional performance cost incurred, trading off for safety against plugins having to do the
|
|
68
|
+
deep check itself.
|
|
@@ -16,22 +16,34 @@ This has many massive side effects, to name just a few:
|
|
|
16
16
|
|
|
17
17
|
- Complexity!
|
|
18
18
|
- devs not being able to clearly reason about the implicit dependencies between plugins
|
|
19
|
-
- extremely difficult to ship features, bug fixes, without breaking something unintended or even
|
|
19
|
+
- extremely difficult to ship features, bug fixes, without breaking something unintended or even
|
|
20
|
+
unrelated
|
|
20
21
|
- Performance!
|
|
21
22
|
- products not being able to integrate a lighter weight of the Atlassian Editor
|
|
22
|
-
- single bundle size whether you only use a handful of features in a small Editor, or the entire
|
|
23
|
+
- single bundle size whether you only use a handful of features in a small Editor, or the entire
|
|
24
|
+
weight of the Full Page Editor
|
|
23
25
|
|
|
24
|
-
We learned from the
|
|
26
|
+
We learned from the
|
|
27
|
+
[table extraction effort](https://product-fabric.atlassian.net/wiki/spaces/E/pages/3289779107/Editor+DACI+019+Bring+Tables+back)
|
|
28
|
+
that it was feasible to extract and untangle one of our most complex Editor Plugins, with some
|
|
29
|
+
temporary APIs to prevent cross importing.
|
|
25
30
|
|
|
26
31
|
## Decision
|
|
27
32
|
|
|
28
|
-
We must now prevent plugins from importing one another to reduce complexity within the Editor. In
|
|
33
|
+
We must now prevent plugins from importing one another to reduce complexity within the Editor. In
|
|
34
|
+
doing so, we can eliminate intricate dependency chains and, using the `getSharedState()` and
|
|
35
|
+
`actions()` APIs, offer a clear understanding of how different plugins share their state.
|
|
29
36
|
|
|
30
|
-
Although making this choice is essential, the aim is to address the initial necessity for cross
|
|
37
|
+
Although making this choice is essential, the aim is to address the initial necessity for cross
|
|
38
|
+
imports to begin with by outlining some "migration examples" and documentation below. This ADR
|
|
39
|
+
outlines two of the APIs that are now in place, to address some of the challenges and insights
|
|
40
|
+
gained from the initial table plugin extraction.
|
|
31
41
|
|
|
32
42
|
### Prevention
|
|
33
43
|
|
|
34
|
-
Linting errors will now be present for any new code that gets added, where we continue to attempt
|
|
44
|
+
Linting errors will now be present for any new code that gets added, where we continue to attempt
|
|
45
|
+
importing from one plugin into another. (See `ELR101`, `ELR102` in
|
|
46
|
+
`repo-docs/content/cloud/framework/atlassian-frontend/editor/lint.md`).
|
|
35
47
|
|
|
36
48
|
### Other resources
|
|
37
49
|
|
|
@@ -42,15 +54,21 @@ Linting errors will now be present for any new code that gets added, where we co
|
|
|
42
54
|
|
|
43
55
|
## Consequences
|
|
44
56
|
|
|
45
|
-
Devs will need to stop importing from one plugin into another, and eventually be blocked on it when
|
|
57
|
+
Devs will need to stop importing from one plugin into another, and eventually be blocked on it when
|
|
58
|
+
we upgrade the lint error from warning to erroring.
|
|
46
59
|
|
|
47
|
-
We are mitigating this, by presenting some samples of how to quickly migrate / "turn on" a plugin
|
|
60
|
+
We are mitigating this, by presenting some samples of how to quickly migrate / "turn on" a plugin
|
|
61
|
+
into utilising the new `actions()` and `getSharedState()` APIs in EditorPlugin.
|
|
48
62
|
|
|
49
|
-
A brief "HOWTO" / "HOW TO" guide of how you can migrate existing or new "cross imports", and get the
|
|
63
|
+
A brief "HOWTO" / "HOW TO" guide of how you can migrate existing or new "cross imports", and get the
|
|
64
|
+
same functionality:
|
|
50
65
|
|
|
51
66
|
## 1. `getSharedState()` (and `useSharedPluginState()` hook for React Components)
|
|
52
67
|
|
|
53
|
-
**Problem**: Let's say you want to access the state from `Foo` plugin, into a second Plugin `Bar`.
|
|
68
|
+
**Problem**: Let's say you want to access the state from `Foo` plugin, into a second Plugin `Bar`.
|
|
69
|
+
Something like `previouslyInternalStateA`. Previously, you needed to import that plugin key, and
|
|
70
|
+
then use it. Now we can use `getSharedState()` and 2 methods `currentState()` & `onChange` methods
|
|
71
|
+
on `api.dependencies.[plugin-name].sharedState`.
|
|
54
72
|
|
|
55
73
|
### **Before**
|
|
56
74
|
|
|
@@ -67,7 +85,8 @@ doSomethingBasedOnAnotherPluginInternalState(previouslyInternalStateC);
|
|
|
67
85
|
|
|
68
86
|
### **After**
|
|
69
87
|
|
|
70
|
-
**Explicit state dependency**, `Foo` plugin "pushes" out, explicitly publicly, shares state surfaced
|
|
88
|
+
**Explicit state dependency**, `Foo` plugin "pushes" out, explicitly publicly, shares state surfaced
|
|
89
|
+
from `internalFooPlugin` prosemirror state internals, for _any_ plugin to use.
|
|
71
90
|
|
|
72
91
|
### Usage inside general `EditorPlugin` and prosemirror plugins:
|
|
73
92
|
|
|
@@ -172,7 +191,8 @@ const fooPlugin: NextEditorPlugin <...> {
|
|
|
172
191
|
|
|
173
192
|
### Usage inside a React component
|
|
174
193
|
|
|
175
|
-
(See date plugin at `packages/editor/editor-plugin-date/src/plugin.tsx` for a full code sample of
|
|
194
|
+
(See date plugin at `packages/editor/editor-plugin-date/src/plugin.tsx` for a full code sample of
|
|
195
|
+
using `useSharedPluginState`)
|
|
176
196
|
|
|
177
197
|
```ts
|
|
178
198
|
// editor-core/src/plugins/bar-some-react-component-based-plugin/index.tsx
|
|
@@ -204,19 +224,28 @@ const barPlugin: NextEditorPlugin<
|
|
|
204
224
|
|
|
205
225
|
Important parts to note:
|
|
206
226
|
|
|
207
|
-
1. You will need to implement a new `getSharedState()` function inside the current `EditorPlugin`
|
|
227
|
+
1. You will need to implement a new `getSharedState()` function inside the current `EditorPlugin`
|
|
228
|
+
that you require the state from, to expose any "public state" that you would like to make
|
|
229
|
+
available to other plugins. **Treat this state as "public API" for other plugins**, as any plugin
|
|
230
|
+
will be able to depend on this and react to it.
|
|
208
231
|
|
|
209
|
-
2. You _may_ need to update `packages/editor/editor-core/src/labs/next/presets/universal.ts`, if you
|
|
232
|
+
2. You _may_ need to update `packages/editor/editor-core/src/labs/next/presets/universal.ts`, if you
|
|
233
|
+
are creating a new EditorPlugin to depend on.
|
|
210
234
|
|
|
211
|
-
3. Anywhere where we used to use `WithPluginState` and import plugin keys, you can now use
|
|
235
|
+
3. Anywhere where we used to use `WithPluginState` and import plugin keys, you can now use
|
|
236
|
+
`useSharedPluginState`
|
|
212
237
|
|
|
213
238
|
## 2. `actions()`
|
|
214
239
|
|
|
215
|
-
For a full code sample, please see `actions()` implementation in
|
|
240
|
+
For a full code sample, please see `actions()` implementation in
|
|
241
|
+
https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/31264?w=1#chg_packages/editor/editor-core/src/plugins/analytics/plugin.ts_newline116
|
|
216
242
|
|
|
217
|
-
Our first attempt with actions, was on the analytics plugin, which touches almost all plugins and
|
|
243
|
+
Our first attempt with actions, was on the analytics plugin, which touches almost all plugins and
|
|
244
|
+
surfaced some other issues. However the same approach can be applied at a smaller scale, for smaller
|
|
245
|
+
plugins that have "cross action dependencies".
|
|
218
246
|
|
|
219
|
-
**Problem**: Let's say you had an "`addAnalytics()`" action, used in the `Foo` plugin, and wanted to
|
|
247
|
+
**Problem**: Let's say you had an "`addAnalytics()`" action, used in the `Foo` plugin, and wanted to
|
|
248
|
+
use it inside of a second, `Bar` plugin.
|
|
220
249
|
|
|
221
250
|
### **Before**
|
|
222
251
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { removeConfigPanelWidthProp } from './migrates/remove-config-panel-width-prop';
|
|
2
2
|
import { createTransformer } from './utils';
|
|
3
3
|
|
|
4
|
-
const transformer = createTransformer('@atlaskit/editor-core', [
|
|
5
|
-
removeConfigPanelWidthProp,
|
|
6
|
-
]);
|
|
4
|
+
const transformer = createTransformer('@atlaskit/editor-core', [removeConfigPanelWidthProp]);
|
|
7
5
|
|
|
8
6
|
export default transformer;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { renameUnsafeCardProp } from './migrates/rename-unsafe-cards-prop';
|
|
2
2
|
import { createTransformer } from './utils';
|
|
3
3
|
|
|
4
|
-
const transformer = createTransformer('@atlaskit/editor-core', [
|
|
5
|
-
renameUnsafeCardProp,
|
|
6
|
-
]);
|
|
4
|
+
const transformer = createTransformer('@atlaskit/editor-core', [renameUnsafeCardProp]);
|
|
7
5
|
|
|
8
6
|
export default transformer;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { renameSmartLinksProp } from './migrates/rename-smartlinks-prop';
|
|
2
2
|
import { createTransformer } from './utils';
|
|
3
3
|
|
|
4
|
-
const transformer = createTransformer('@atlaskit/editor-core', [
|
|
5
|
-
renameSmartLinksProp,
|
|
6
|
-
]);
|
|
4
|
+
const transformer = createTransformer('@atlaskit/editor-core', [renameSmartLinksProp]);
|
|
7
5
|
|
|
8
6
|
export default transformer;
|
|
@@ -2,7 +2,7 @@ import { renameUnsafeAllowUndoRedoButtonsProp } from './migrates/rename-unsafe-a
|
|
|
2
2
|
import { createTransformer } from './utils';
|
|
3
3
|
|
|
4
4
|
const transformer = createTransformer('@atlaskit/editor-core', [
|
|
5
|
-
|
|
5
|
+
renameUnsafeAllowUndoRedoButtonsProp,
|
|
6
6
|
]);
|
|
7
7
|
|
|
8
8
|
export default transformer;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { renameEditorToMigrationComponent } from './migrates/rename-editor-to-editor-migration-component';
|
|
2
2
|
import { createTransformer } from './utils';
|
|
3
3
|
|
|
4
|
-
const transformer = createTransformer('@atlaskit/editor-core', [
|
|
5
|
-
renameEditorToMigrationComponent,
|
|
6
|
-
]);
|
|
4
|
+
const transformer = createTransformer('@atlaskit/editor-core', [renameEditorToMigrationComponent]);
|
|
7
5
|
|
|
8
6
|
export default transformer;
|
|
@@ -4,14 +4,12 @@ import { createTransformer } from '../utils';
|
|
|
4
4
|
|
|
5
5
|
// This stays as require() since changing to import will trigger a linter error
|
|
6
6
|
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
7
|
-
const transformer = createTransformer('@atlaskit/editor-core', [
|
|
8
|
-
removeAllowMoreColorsProp,
|
|
9
|
-
]);
|
|
7
|
+
const transformer = createTransformer('@atlaskit/editor-core', [removeAllowMoreColorsProp]);
|
|
10
8
|
describe('remove `allowMoreTextColors` field from `allowTextColor` Editor prop.', () => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
defineInlineTest(
|
|
10
|
+
{ default: transformer, parser: 'tsx' },
|
|
11
|
+
{},
|
|
12
|
+
`
|
|
15
13
|
import React from 'react';
|
|
16
14
|
import { Editor } from '@atlaskit/editor-core';
|
|
17
15
|
export default () => <Editor
|
|
@@ -24,7 +22,7 @@ describe('remove `allowMoreTextColors` field from `allowTextColor` Editor prop.'
|
|
|
24
22
|
allowStatus={true}
|
|
25
23
|
/>
|
|
26
24
|
`, // -----
|
|
27
|
-
|
|
25
|
+
`
|
|
28
26
|
import React from 'react';
|
|
29
27
|
import { Editor } from '@atlaskit/editor-core';
|
|
30
28
|
export default () => <Editor
|
|
@@ -36,12 +34,12 @@ describe('remove `allowMoreTextColors` field from `allowTextColor` Editor prop.'
|
|
|
36
34
|
allowStatus={true}
|
|
37
35
|
/>
|
|
38
36
|
`, // -----
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
'remove allowMoreTextColors field if it exists',
|
|
38
|
+
);
|
|
39
|
+
defineInlineTest(
|
|
40
|
+
{ default: transformer, parser: 'tsx' },
|
|
41
|
+
{},
|
|
42
|
+
`
|
|
45
43
|
import React from 'react';
|
|
46
44
|
import { Editor } from '@atlaskit/editor-core';
|
|
47
45
|
export default () => <Editor
|
|
@@ -53,7 +51,7 @@ describe('remove `allowMoreTextColors` field from `allowTextColor` Editor prop.'
|
|
|
53
51
|
}
|
|
54
52
|
/>
|
|
55
53
|
`, // -----
|
|
56
|
-
|
|
54
|
+
`
|
|
57
55
|
import React from 'react';
|
|
58
56
|
import { Editor } from '@atlaskit/editor-core';
|
|
59
57
|
export default () => <Editor
|
|
@@ -61,12 +59,12 @@ describe('remove `allowMoreTextColors` field from `allowTextColor` Editor prop.'
|
|
|
61
59
|
allowTextColor={true}
|
|
62
60
|
/>
|
|
63
61
|
`, // -----
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
'set allowTextColor prop value to `true` if allowMoreTextColors is its only field',
|
|
63
|
+
);
|
|
64
|
+
defineInlineTest(
|
|
65
|
+
{ default: transformer, parser: 'tsx' },
|
|
66
|
+
{},
|
|
67
|
+
`
|
|
70
68
|
import React from 'react';
|
|
71
69
|
import { Editor as MyEditor } from '@atlaskit/editor-core';
|
|
72
70
|
export default () => <Editor
|
|
@@ -79,7 +77,7 @@ describe('remove `allowMoreTextColors` field from `allowTextColor` Editor prop.'
|
|
|
79
77
|
}
|
|
80
78
|
/>
|
|
81
79
|
`, // -----
|
|
82
|
-
|
|
80
|
+
`
|
|
83
81
|
import React from 'react';
|
|
84
82
|
import { Editor as MyEditor } from '@atlaskit/editor-core';
|
|
85
83
|
export default () => <Editor
|
|
@@ -91,12 +89,12 @@ describe('remove `allowMoreTextColors` field from `allowTextColor` Editor prop.'
|
|
|
91
89
|
}
|
|
92
90
|
/>
|
|
93
91
|
`, // -----
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
'remove allowMoreTextColors prop prop when Editor is renamed',
|
|
93
|
+
);
|
|
94
|
+
defineInlineTest(
|
|
95
|
+
{ default: transformer, parser: 'tsx' },
|
|
96
|
+
{},
|
|
97
|
+
`
|
|
100
98
|
import React from 'react';
|
|
101
99
|
const Editor = (props) => {
|
|
102
100
|
<div>{props.children}</div>
|
|
@@ -111,7 +109,7 @@ describe('remove `allowMoreTextColors` field from `allowTextColor` Editor prop.'
|
|
|
111
109
|
}
|
|
112
110
|
/>
|
|
113
111
|
`, // -----
|
|
114
|
-
|
|
112
|
+
`
|
|
115
113
|
import React from 'react';
|
|
116
114
|
const Editor = (props) => {
|
|
117
115
|
<div>{props.children}</div>
|
|
@@ -126,6 +124,6 @@ describe('remove `allowMoreTextColors` field from `allowTextColor` Editor prop.'
|
|
|
126
124
|
}
|
|
127
125
|
/>
|
|
128
126
|
`, // -----
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
'only remove allowMoreTextColors prop for Editor from @atlaskit/editor-core',
|
|
128
|
+
);
|
|
131
129
|
});
|
|
@@ -6,15 +6,13 @@ import { createTransformer } from '../utils';
|
|
|
6
6
|
// This stays as require() since changing to import will trigger a linter error
|
|
7
7
|
const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
|
|
8
8
|
|
|
9
|
-
const transformer = createTransformer('@atlaskit/editor-core', [
|
|
10
|
-
removeConfigPanelWidthProp,
|
|
11
|
-
]);
|
|
9
|
+
const transformer = createTransformer('@atlaskit/editor-core', [removeConfigPanelWidthProp]);
|
|
12
10
|
|
|
13
11
|
describe('Remove ContextPanel "width" prop', () => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
defineInlineTest(
|
|
13
|
+
{ default: transformer, parser: 'tsx' },
|
|
14
|
+
{},
|
|
15
|
+
`
|
|
18
16
|
import React from 'react';
|
|
19
17
|
import { ContextPanel } from '@atlaskit/editor-core';
|
|
20
18
|
|
|
@@ -24,7 +22,7 @@ describe('Remove ContextPanel "width" prop', () => {
|
|
|
24
22
|
</ContextPanel>
|
|
25
23
|
);
|
|
26
24
|
`, // -----
|
|
27
|
-
|
|
25
|
+
`
|
|
28
26
|
import React from 'react';
|
|
29
27
|
import { ContextPanel } from '@atlaskit/editor-core';
|
|
30
28
|
|
|
@@ -34,13 +32,13 @@ describe('Remove ContextPanel "width" prop', () => {
|
|
|
34
32
|
</ContextPanel>
|
|
35
33
|
);
|
|
36
34
|
`, // -----
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
'remove if width prop is set',
|
|
36
|
+
);
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
defineInlineTest(
|
|
39
|
+
{ default: transformer, parser: 'tsx' },
|
|
40
|
+
{},
|
|
41
|
+
`
|
|
44
42
|
import React from 'react';
|
|
45
43
|
import { ContextPanel } from '@atlaskit/editor-core';
|
|
46
44
|
|
|
@@ -50,7 +48,7 @@ describe('Remove ContextPanel "width" prop', () => {
|
|
|
50
48
|
</ContextPanel>
|
|
51
49
|
);
|
|
52
50
|
`, // -----
|
|
53
|
-
|
|
51
|
+
`
|
|
54
52
|
import React from 'react';
|
|
55
53
|
import { ContextPanel } from '@atlaskit/editor-core';
|
|
56
54
|
|
|
@@ -60,13 +58,13 @@ describe('Remove ContextPanel "width" prop', () => {
|
|
|
60
58
|
</ContextPanel>
|
|
61
59
|
);
|
|
62
60
|
`, // -----
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
'remove nothing if width prop not set',
|
|
62
|
+
);
|
|
65
63
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
defineInlineTest(
|
|
65
|
+
{ default: transformer, parser: 'tsx' },
|
|
66
|
+
{},
|
|
67
|
+
`
|
|
70
68
|
import React from 'react';
|
|
71
69
|
import { ContextPanel as AKContextPanel } from '@atlaskit/editor-core';
|
|
72
70
|
|
|
@@ -76,7 +74,7 @@ describe('Remove ContextPanel "width" prop', () => {
|
|
|
76
74
|
</AKContextPanel>
|
|
77
75
|
);
|
|
78
76
|
`, // -----
|
|
79
|
-
|
|
77
|
+
`
|
|
80
78
|
import React from 'react';
|
|
81
79
|
import { ContextPanel as AKContextPanel } from '@atlaskit/editor-core';
|
|
82
80
|
|
|
@@ -86,13 +84,13 @@ describe('Remove ContextPanel "width" prop', () => {
|
|
|
86
84
|
</AKContextPanel>
|
|
87
85
|
);
|
|
88
86
|
`, // -----
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
'remove width prop when ContextPanel is renamed',
|
|
88
|
+
);
|
|
91
89
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
defineInlineTest(
|
|
91
|
+
{ default: transformer, parser: 'tsx' },
|
|
92
|
+
{},
|
|
93
|
+
`
|
|
96
94
|
import React from 'react';
|
|
97
95
|
|
|
98
96
|
const ContextPanel = (props) => {
|
|
@@ -105,7 +103,7 @@ describe('Remove ContextPanel "width" prop', () => {
|
|
|
105
103
|
</ContextPanel>
|
|
106
104
|
);
|
|
107
105
|
`, // -----
|
|
108
|
-
|
|
106
|
+
`
|
|
109
107
|
import React from 'react';
|
|
110
108
|
|
|
111
109
|
const ContextPanel = (props) => {
|
|
@@ -118,6 +116,6 @@ describe('Remove ContextPanel "width" prop', () => {
|
|
|
118
116
|
</ContextPanel>
|
|
119
117
|
);
|
|
120
118
|
`, // -----
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
'only remove width for ContextPanel from @atlaskit/editor-core',
|
|
120
|
+
);
|
|
123
121
|
});
|