@atlaskit/editor-plugin-show-diff 8.3.3 → 8.3.5

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,18 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 8.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d672ff18b0e43`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d672ff18b0e43) -
8
+ Use post-step doc to simplify changes.
9
+
10
+ ## 8.3.4
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 8.3.3
4
17
 
5
18
  ### Patch Changes
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "extends": "../../../../tsconfig.local-consumption.json",
3
3
  "compilerOptions": {
4
- "target": "es5",
5
4
  "outDir": "../../../../../confluence/tsDist/@atlaskit__editor-plugin-show-diff",
6
5
  "rootDir": "../",
7
6
  "composite": true,
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "extends": "../../../../tsconfig.local-consumption.json",
3
3
  "compilerOptions": {
4
- "target": "es5",
5
4
  "outDir": "../../../../../tsDist/@atlaskit__editor-plugin-show-diff/app",
6
5
  "rootDir": "../",
7
6
  "composite": true,
@@ -133,7 +133,13 @@ var diffBySteps = exports.diffBySteps = function diffBySteps(originalDoc, steps)
133
133
  var toB = mapPosition(afterStepToFinal, toAfterStep);
134
134
  if (isReplaceStepForTextBlockNode(rangedStep.step, rangedStep.before, rangedStep.from, rangedStep.to)) {
135
135
  var granularStepChanges = _prosemirrorChangeset.ChangeSet.create(rangedStep.before).addSteps(rangedStep.doc, [rangedStep.stepMap], null);
136
- var optimizedGranularStepChanges = (0, _optimizeChanges.optimizeChanges)((0, _prosemirrorChangeset.simplifyChanges)(granularStepChanges.changes, granularStepChanges.startDoc));
136
+
137
+ // `simplifyChanges` reads text using `Change.fromB`/`toB`, which are
138
+ // positions in the post-step doc (the "B" doc). Passing the pre-step
139
+ // doc (`startDoc`) misreads characters and produces mid-word cuts
140
+ // (e.g. "deep-s|ea") because word-boundary detection runs against the
141
+ // wrong text/positions. Use the post-step doc here.
142
+ var optimizedGranularStepChanges = (0, _optimizeChanges.optimizeChanges)((0, _prosemirrorChangeset.simplifyChanges)(granularStepChanges.changes, rangedStep.doc));
137
143
  var _iterator3 = _createForOfIteratorHelper(optimizedGranularStepChanges),
138
144
  _step3;
139
145
  try {
@@ -98,7 +98,13 @@ export const diffBySteps = (originalDoc, steps) => {
98
98
  const toB = mapPosition(afterStepToFinal, toAfterStep);
99
99
  if (isReplaceStepForTextBlockNode(rangedStep.step, rangedStep.before, rangedStep.from, rangedStep.to)) {
100
100
  const granularStepChanges = ChangeSet.create(rangedStep.before).addSteps(rangedStep.doc, [rangedStep.stepMap], null);
101
- const optimizedGranularStepChanges = optimizeChanges(simplifyChanges(granularStepChanges.changes, granularStepChanges.startDoc));
101
+
102
+ // `simplifyChanges` reads text using `Change.fromB`/`toB`, which are
103
+ // positions in the post-step doc (the "B" doc). Passing the pre-step
104
+ // doc (`startDoc`) misreads characters and produces mid-word cuts
105
+ // (e.g. "deep-s|ea") because word-boundary detection runs against the
106
+ // wrong text/positions. Use the post-step doc here.
107
+ const optimizedGranularStepChanges = optimizeChanges(simplifyChanges(granularStepChanges.changes, rangedStep.doc));
102
108
  for (const granularChange of optimizedGranularStepChanges) {
103
109
  const granularFromA = mapPosition(beforeStepToOriginal, granularChange.fromA);
104
110
  const granularToA = mapPosition(beforeStepToOriginal, granularChange.toA);
@@ -126,7 +126,13 @@ export var diffBySteps = function diffBySteps(originalDoc, steps) {
126
126
  var toB = mapPosition(afterStepToFinal, toAfterStep);
127
127
  if (isReplaceStepForTextBlockNode(rangedStep.step, rangedStep.before, rangedStep.from, rangedStep.to)) {
128
128
  var granularStepChanges = ChangeSet.create(rangedStep.before).addSteps(rangedStep.doc, [rangedStep.stepMap], null);
129
- var optimizedGranularStepChanges = optimizeChanges(simplifyChanges(granularStepChanges.changes, granularStepChanges.startDoc));
129
+
130
+ // `simplifyChanges` reads text using `Change.fromB`/`toB`, which are
131
+ // positions in the post-step doc (the "B" doc). Passing the pre-step
132
+ // doc (`startDoc`) misreads characters and produces mid-word cuts
133
+ // (e.g. "deep-s|ea") because word-boundary detection runs against the
134
+ // wrong text/positions. Use the post-step doc here.
135
+ var optimizedGranularStepChanges = optimizeChanges(simplifyChanges(granularStepChanges.changes, rangedStep.doc));
130
136
  var _iterator3 = _createForOfIteratorHelper(optimizedGranularStepChanges),
131
137
  _step3;
132
138
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "8.3.3",
3
+ "version": "8.3.5",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,7 +35,7 @@
35
35
  "@atlaskit/editor-prosemirror": "^7.3.0",
36
36
  "@atlaskit/editor-tables": "^2.9.0",
37
37
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
- "@atlaskit/tmp-editor-statsig": "^76.0.0",
38
+ "@atlaskit/tmp-editor-statsig": "^77.1.0",
39
39
  "@atlaskit/tokens": "^13.0.0",
40
40
  "@babel/runtime": "^7.0.0",
41
41
  "lodash": "^4.17.21",
@@ -58,7 +58,7 @@
58
58
  "react-intl": "^6.6.2"
59
59
  },
60
60
  "peerDependencies": {
61
- "@atlaskit/editor-common": "^114.20.0",
61
+ "@atlaskit/editor-common": "^114.21.0",
62
62
  "react": "^18.2.0"
63
63
  },
64
64
  "techstack": {
@@ -1,49 +0,0 @@
1
- {
2
- "extends": "../../../../tsconfig.local-consumption.json",
3
- "compilerOptions": {
4
- "target": "es5",
5
- "outDir": "../../../../../jira/tsDist/@atlaskit__editor-plugin-show-diff/app",
6
- "rootDir": "../",
7
- "composite": true,
8
- "noCheck": true
9
- },
10
- "include": [
11
- "../src/**/*.ts",
12
- "../src/**/*.tsx"
13
- ],
14
- "exclude": [
15
- "../src/**/__tests__/*",
16
- "../src/**/*.test.*",
17
- "../src/**/test.*",
18
- "../src/**/examples.*"
19
- ],
20
- "references": [
21
- {
22
- "path": "../../adf-schema/afm-jira/tsconfig.json"
23
- },
24
- {
25
- "path": "../../custom-steps/afm-jira/tsconfig.json"
26
- },
27
- {
28
- "path": "../../editor-plugin-analytics/afm-jira/tsconfig.json"
29
- },
30
- {
31
- "path": "../../editor-prosemirror/afm-jira/tsconfig.json"
32
- },
33
- {
34
- "path": "../../editor-tables/afm-jira/tsconfig.json"
35
- },
36
- {
37
- "path": "../../../platform/feature-flags/afm-jira/tsconfig.json"
38
- },
39
- {
40
- "path": "../../tmp-editor-statsig/afm-jira/tsconfig.json"
41
- },
42
- {
43
- "path": "../../../design-system/tokens/afm-jira/tsconfig.json"
44
- },
45
- {
46
- "path": "../../editor-common/afm-jira/tsconfig.json"
47
- }
48
- ]
49
- }