@atlaskit/editor-plugin-local-id 14.0.9 → 14.0.11

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-local-id
2
2
 
3
+ ## 14.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 14.0.10
10
+
11
+ ### Patch Changes
12
+
13
+ - [`a945d3cbd6408`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a945d3cbd6408) -
14
+ Clean up experiment `platform_editor_ai_template_localids`
15
+ - Updated dependencies
16
+
3
17
  ## 14.0.9
4
18
 
5
19
  ### Patch Changes
@@ -12,7 +12,6 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
12
12
  var _utils = require("@atlaskit/editor-common/utils");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
14
  var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
15
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
15
  var _editorCommands = require("../editor-commands");
17
16
  var _addMissingLocalIds = require("./add-missing-local-ids");
18
17
  var _generateShortUUID = require("./generateShortUUID");
@@ -112,28 +111,19 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
112
111
  if (!transaction.docChanged) {
113
112
  return;
114
113
  }
115
- if ((0, _expValEquals.expValEquals)('platform_editor_ai_template_localids', 'isEnabled', true)) {
116
- if (transaction.getMeta('uiEvent') === 'cut' ||
117
- // We skip remote transactions as we don't want to affect transactions
118
- // created by other collaborators.
119
- //
120
- // Exception (platform_editor_ai_template_localids): applying a template to a
121
- // blank page arrives as a remote OverrideDocumentStep (a full-document
122
- // replacement with no localIds). We still want those template nodes to get
123
- // localIds, so we let such transactions through. Ordinary remote edits are
124
- // still skipped, and existing localIds are never overwritten.
125
- Boolean(transaction.getMeta('isRemote')) && !transaction.steps.some(function (step) {
126
- return step instanceof _steps.OverrideDocumentStep;
127
- })) {
128
- return;
129
- }
130
- } else {
131
- if (transaction.getMeta('uiEvent') === 'cut' ||
132
- // We skip remote transactions as we don't want to affect transactions created
133
- // by other users
134
- Boolean(transaction.getMeta('isRemote'))) {
135
- return;
136
- }
114
+ if (transaction.getMeta('uiEvent') === 'cut' ||
115
+ // We skip remote transactions as we don't want to affect transactions
116
+ // created by other collaborators.
117
+ //
118
+ // Applying a template to a blank page arrives as a remote
119
+ // OverrideDocumentStep (a full-document replacement with no localIds).
120
+ // We still want those template nodes to get localIds, so we let such
121
+ // transactions through. Ordinary remote edits are still skipped, and
122
+ // existing localIds are never overwritten.
123
+ Boolean(transaction.getMeta('isRemote')) && !transaction.steps.some(function (step) {
124
+ return step instanceof _steps.OverrideDocumentStep;
125
+ })) {
126
+ return;
137
127
  }
138
128
 
139
129
  // Ignore local ID updates for certain transactions
@@ -144,10 +134,9 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
144
134
  }
145
135
  transaction.steps.forEach(function (step) {
146
136
  // Steps with a slice are scanned for nodes that need localIds.
147
- // OverrideDocumentStep (template replacement) has no `slice`, so when the
148
- // experiment is on we also scan it so the inserted template nodes get
149
- // localIds.
150
- var isTemplateOverrideStep = step instanceof _steps.OverrideDocumentStep && (0, _expValEquals.expValEquals)('platform_editor_ai_template_localids', 'isEnabled', true);
137
+ // OverrideDocumentStep (template replacement) has no `slice`, so we also
138
+ // scan it so the inserted template nodes get localIds.
139
+ var isTemplateOverrideStep = step instanceof _steps.OverrideDocumentStep;
151
140
  if (!(0, _utils.stepHasSlice)(step) && !isTemplateOverrideStep) {
152
141
  return;
153
142
  }
@@ -4,7 +4,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import { stepHasSlice } from '@atlaskit/editor-common/utils';
5
5
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
6
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
7
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
7
  import { addMissingLocalIds } from '../editor-commands';
9
8
  import { batchAddLocalIdToNodes, localIdNotEmpty } from './add-missing-local-ids';
10
9
  import { generateShortUUID, generatedShortUUIDs } from './generateShortUUID';
@@ -103,26 +102,17 @@ export const createPlugin = api => {
103
102
  if (!transaction.docChanged) {
104
103
  return;
105
104
  }
106
- if (expValEquals('platform_editor_ai_template_localids', 'isEnabled', true)) {
107
- if (transaction.getMeta('uiEvent') === 'cut' ||
108
- // We skip remote transactions as we don't want to affect transactions
109
- // created by other collaborators.
110
- //
111
- // Exception (platform_editor_ai_template_localids): applying a template to a
112
- // blank page arrives as a remote OverrideDocumentStep (a full-document
113
- // replacement with no localIds). We still want those template nodes to get
114
- // localIds, so we let such transactions through. Ordinary remote edits are
115
- // still skipped, and existing localIds are never overwritten.
116
- Boolean(transaction.getMeta('isRemote')) && !transaction.steps.some(step => step instanceof OverrideDocumentStep)) {
117
- return;
118
- }
119
- } else {
120
- if (transaction.getMeta('uiEvent') === 'cut' ||
121
- // We skip remote transactions as we don't want to affect transactions created
122
- // by other users
123
- Boolean(transaction.getMeta('isRemote'))) {
124
- return;
125
- }
105
+ if (transaction.getMeta('uiEvent') === 'cut' ||
106
+ // We skip remote transactions as we don't want to affect transactions
107
+ // created by other collaborators.
108
+ //
109
+ // Applying a template to a blank page arrives as a remote
110
+ // OverrideDocumentStep (a full-document replacement with no localIds).
111
+ // We still want those template nodes to get localIds, so we let such
112
+ // transactions through. Ordinary remote edits are still skipped, and
113
+ // existing localIds are never overwritten.
114
+ Boolean(transaction.getMeta('isRemote')) && !transaction.steps.some(step => step instanceof OverrideDocumentStep)) {
115
+ return;
126
116
  }
127
117
 
128
118
  // Ignore local ID updates for certain transactions
@@ -133,10 +123,9 @@ export const createPlugin = api => {
133
123
  }
134
124
  transaction.steps.forEach(step => {
135
125
  // Steps with a slice are scanned for nodes that need localIds.
136
- // OverrideDocumentStep (template replacement) has no `slice`, so when the
137
- // experiment is on we also scan it so the inserted template nodes get
138
- // localIds.
139
- const isTemplateOverrideStep = step instanceof OverrideDocumentStep && expValEquals('platform_editor_ai_template_localids', 'isEnabled', true);
126
+ // OverrideDocumentStep (template replacement) has no `slice`, so we also
127
+ // scan it so the inserted template nodes get localIds.
128
+ const isTemplateOverrideStep = step instanceof OverrideDocumentStep;
140
129
  if (!stepHasSlice(step) && !isTemplateOverrideStep) {
141
130
  return;
142
131
  }
@@ -8,7 +8,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
8
  import { stepHasSlice } from '@atlaskit/editor-common/utils';
9
9
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
10
10
  import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
11
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
11
  import { addMissingLocalIds } from '../editor-commands';
13
12
  import { batchAddLocalIdToNodes, localIdNotEmpty } from './add-missing-local-ids';
14
13
  import { generateShortUUID, generatedShortUUIDs } from './generateShortUUID';
@@ -105,28 +104,19 @@ export var createPlugin = function createPlugin(api) {
105
104
  if (!transaction.docChanged) {
106
105
  return;
107
106
  }
108
- if (expValEquals('platform_editor_ai_template_localids', 'isEnabled', true)) {
109
- if (transaction.getMeta('uiEvent') === 'cut' ||
110
- // We skip remote transactions as we don't want to affect transactions
111
- // created by other collaborators.
112
- //
113
- // Exception (platform_editor_ai_template_localids): applying a template to a
114
- // blank page arrives as a remote OverrideDocumentStep (a full-document
115
- // replacement with no localIds). We still want those template nodes to get
116
- // localIds, so we let such transactions through. Ordinary remote edits are
117
- // still skipped, and existing localIds are never overwritten.
118
- Boolean(transaction.getMeta('isRemote')) && !transaction.steps.some(function (step) {
119
- return step instanceof OverrideDocumentStep;
120
- })) {
121
- return;
122
- }
123
- } else {
124
- if (transaction.getMeta('uiEvent') === 'cut' ||
125
- // We skip remote transactions as we don't want to affect transactions created
126
- // by other users
127
- Boolean(transaction.getMeta('isRemote'))) {
128
- return;
129
- }
107
+ if (transaction.getMeta('uiEvent') === 'cut' ||
108
+ // We skip remote transactions as we don't want to affect transactions
109
+ // created by other collaborators.
110
+ //
111
+ // Applying a template to a blank page arrives as a remote
112
+ // OverrideDocumentStep (a full-document replacement with no localIds).
113
+ // We still want those template nodes to get localIds, so we let such
114
+ // transactions through. Ordinary remote edits are still skipped, and
115
+ // existing localIds are never overwritten.
116
+ Boolean(transaction.getMeta('isRemote')) && !transaction.steps.some(function (step) {
117
+ return step instanceof OverrideDocumentStep;
118
+ })) {
119
+ return;
130
120
  }
131
121
 
132
122
  // Ignore local ID updates for certain transactions
@@ -137,10 +127,9 @@ export var createPlugin = function createPlugin(api) {
137
127
  }
138
128
  transaction.steps.forEach(function (step) {
139
129
  // Steps with a slice are scanned for nodes that need localIds.
140
- // OverrideDocumentStep (template replacement) has no `slice`, so when the
141
- // experiment is on we also scan it so the inserted template nodes get
142
- // localIds.
143
- var isTemplateOverrideStep = step instanceof OverrideDocumentStep && expValEquals('platform_editor_ai_template_localids', 'isEnabled', true);
130
+ // OverrideDocumentStep (template replacement) has no `slice`, so we also
131
+ // scan it so the inserted template nodes get localIds.
132
+ var isTemplateOverrideStep = step instanceof OverrideDocumentStep;
144
133
  if (!stepHasSlice(step) && !isTemplateOverrideStep) {
145
134
  return;
146
135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-local-id",
3
- "version": "14.0.9",
3
+ "version": "14.0.11",
4
4
  "description": "LocalId plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,7 @@
27
27
  "@atlaskit/editor-prosemirror": "^8.0.0",
28
28
  "@atlaskit/platform-feature-experiments": "^0.3.0",
29
29
  "@atlaskit/platform-feature-flags": "^2.2.0",
30
- "@atlaskit/tmp-editor-statsig": "^169.0.0",
30
+ "@atlaskit/tmp-editor-statsig": "^171.0.0",
31
31
  "@babel/runtime": "^7.0.0",
32
32
  "raf-schd": "^4.0.3"
33
33
  },