@atlaskit/editor-plugin-find-replace 7.0.14 → 7.0.15
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/dist/cjs/pm-plugins/plugin-factory.js +1 -4
- package/dist/cjs/pm-plugins/utils/index.js +9 -1
- package/dist/es2019/pm-plugins/plugin-factory.js +1 -3
- package/dist/es2019/pm-plugins/utils/index.js +4 -1
- package/dist/esm/pm-plugins/plugin-factory.js +1 -3
- package/dist/esm/pm-plugins/utils/index.js +8 -1
- package/dist/types/pm-plugins/utils/index.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/utils/index.d.ts +1 -0
- package/package.json +2 -2
- package/dist/cjs/pm-plugins/utils/array.js +0 -13
- package/dist/es2019/pm-plugins/utils/array.js +0 -3
- package/dist/esm/pm-plugins/utils/array.js +0 -7
- package/dist/types/pm-plugins/utils/array.d.ts +0 -1
- package/dist/types-ts4.5/pm-plugins/utils/array.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-find-replace
|
|
2
2
|
|
|
3
|
+
## 7.0.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5690cd6294eda`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5690cd6294eda) -
|
|
8
|
+
[EDITOR-5042] Moves findUniqueItemsIn export to index
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 7.0.14
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -15,11 +15,8 @@ var _main = require("./main");
|
|
|
15
15
|
var _pluginKey = require("./plugin-key");
|
|
16
16
|
var _reducer = _interopRequireDefault(require("./reducer"));
|
|
17
17
|
var _utils2 = require("./utils");
|
|
18
|
-
var _array = require("./utils/array");
|
|
19
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
19
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
-
// TODO: ED-26959 - move into index export
|
|
22
|
-
|
|
23
20
|
var handleDocChanged = function handleDocChanged(tr, pluginState) {
|
|
24
21
|
var isActive = pluginState.isActive,
|
|
25
22
|
findText = pluginState.findText;
|
|
@@ -74,7 +71,7 @@ var handleDocChanged = function handleDocChanged(tr, pluginState) {
|
|
|
74
71
|
|
|
75
72
|
// delete any matches that are missing from the newMatches array and have a
|
|
76
73
|
// corresponding decoration
|
|
77
|
-
matchesToDelete = [].concat((0, _toConsumableArray2.default)(matchesToDelete), (0, _toConsumableArray2.default)((0,
|
|
74
|
+
matchesToDelete = [].concat((0, _toConsumableArray2.default)(matchesToDelete), (0, _toConsumableArray2.default)((0, _utils2.findUniqueItemsIn)(mappedMatches.filter(function (match) {
|
|
78
75
|
return (0, _utils2.isMatchAffectedByStep)(match, step, tr) && !!(0, _utils2.findDecorationFromMatch)(decorationSet, match);
|
|
79
76
|
}), newMatches, function (firstMatch, secondMatch) {
|
|
80
77
|
return firstMatch.start === secondMatch.start && firstMatch.end === secondMatch.end;
|
|
@@ -9,6 +9,7 @@ exports.findClosestMatch = findClosestMatch;
|
|
|
9
9
|
exports.findLostAdjacentDecorations = exports.findIndexBeforePosition = exports.findDecorationFromMatch = void 0;
|
|
10
10
|
exports.findMatches = findMatches;
|
|
11
11
|
exports.findSearchIndex = findSearchIndex;
|
|
12
|
+
exports.findUniqueItemsIn = findUniqueItemsIn;
|
|
12
13
|
exports.getSelectedText = getSelectedText;
|
|
13
14
|
exports.removeMatchesFromSet = exports.removeDecorationsFromSet = exports.prevIndex = exports.nextIndex = exports.isMatchAffectedByStep = exports.getSelectionForMatch = void 0;
|
|
14
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -470,4 +471,11 @@ var isMatchAffectedByStep = exports.isMatchAffectedByStep = function isMatchAffe
|
|
|
470
471
|
slice = step.slice;
|
|
471
472
|
var sliceSize = slice.content.size;
|
|
472
473
|
return from + sliceSize >= match.start && to - sliceSize <= match.end || tr.mapping.map(from) + sliceSize >= match.start && tr.mapping.map(to) - sliceSize <= match.end;
|
|
473
|
-
};
|
|
474
|
+
};
|
|
475
|
+
function findUniqueItemsIn(findIn, checkWith, comparator) {
|
|
476
|
+
return findIn.filter(function (firstItem) {
|
|
477
|
+
return checkWith.findIndex(function (secondItem) {
|
|
478
|
+
return comparator ? comparator(firstItem, secondItem) : firstItem === secondItem;
|
|
479
|
+
}) === -1;
|
|
480
|
+
});
|
|
481
|
+
}
|
|
@@ -5,9 +5,7 @@ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equ
|
|
|
5
5
|
import { initialState } from './main';
|
|
6
6
|
import { findReplacePluginKey } from './plugin-key';
|
|
7
7
|
import reducer from './reducer';
|
|
8
|
-
import { createDecorations, findClosestMatch, findDecorationFromMatch, findMatches, findSearchIndex, getSelectionForMatch, isMatchAffectedByStep, removeDecorationsFromSet, removeMatchesFromSet } from './utils';
|
|
9
|
-
import { findUniqueItemsIn } from './utils/array'; // TODO: ED-26959 - move into index export
|
|
10
|
-
|
|
8
|
+
import { createDecorations, findClosestMatch, findDecorationFromMatch, findMatches, findSearchIndex, findUniqueItemsIn, getSelectionForMatch, isMatchAffectedByStep, removeDecorationsFromSet, removeMatchesFromSet } from './utils';
|
|
11
9
|
const handleDocChanged = (tr, pluginState) => {
|
|
12
10
|
const {
|
|
13
11
|
isActive,
|
|
@@ -436,4 +436,7 @@ export const isMatchAffectedByStep = (match, step, tr) => {
|
|
|
436
436
|
} = step;
|
|
437
437
|
const sliceSize = slice.content.size;
|
|
438
438
|
return from + sliceSize >= match.start && to - sliceSize <= match.end || tr.mapping.map(from) + sliceSize >= match.start && tr.mapping.map(to) - sliceSize <= match.end;
|
|
439
|
-
};
|
|
439
|
+
};
|
|
440
|
+
export function findUniqueItemsIn(findIn, checkWith, comparator) {
|
|
441
|
+
return findIn.filter(firstItem => checkWith.findIndex(secondItem => comparator ? comparator(firstItem, secondItem) : firstItem === secondItem) === -1);
|
|
442
|
+
}
|
|
@@ -9,9 +9,7 @@ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equ
|
|
|
9
9
|
import { initialState } from './main';
|
|
10
10
|
import { findReplacePluginKey } from './plugin-key';
|
|
11
11
|
import reducer from './reducer';
|
|
12
|
-
import { createDecorations, findClosestMatch, findDecorationFromMatch, findMatches, findSearchIndex, getSelectionForMatch, isMatchAffectedByStep, removeDecorationsFromSet, removeMatchesFromSet } from './utils';
|
|
13
|
-
import { findUniqueItemsIn } from './utils/array'; // TODO: ED-26959 - move into index export
|
|
14
|
-
|
|
12
|
+
import { createDecorations, findClosestMatch, findDecorationFromMatch, findMatches, findSearchIndex, findUniqueItemsIn, getSelectionForMatch, isMatchAffectedByStep, removeDecorationsFromSet, removeMatchesFromSet } from './utils';
|
|
15
13
|
var handleDocChanged = function handleDocChanged(tr, pluginState) {
|
|
16
14
|
var isActive = pluginState.isActive,
|
|
17
15
|
findText = pluginState.findText;
|
|
@@ -457,4 +457,11 @@ export var isMatchAffectedByStep = function isMatchAffectedByStep(match, step, t
|
|
|
457
457
|
slice = step.slice;
|
|
458
458
|
var sliceSize = slice.content.size;
|
|
459
459
|
return from + sliceSize >= match.start && to - sliceSize <= match.end || tr.mapping.map(from) + sliceSize >= match.start && tr.mapping.map(to) - sliceSize <= match.end;
|
|
460
|
-
};
|
|
460
|
+
};
|
|
461
|
+
export function findUniqueItemsIn(findIn, checkWith, comparator) {
|
|
462
|
+
return findIn.filter(function (firstItem) {
|
|
463
|
+
return checkWith.findIndex(function (secondItem) {
|
|
464
|
+
return comparator ? comparator(firstItem, secondItem) : firstItem === secondItem;
|
|
465
|
+
}) === -1;
|
|
466
|
+
});
|
|
467
|
+
}
|
|
@@ -56,4 +56,5 @@ export declare const isMatchAffectedByStep: (match: Match, step: Step & {
|
|
|
56
56
|
slice: Slice;
|
|
57
57
|
to: number;
|
|
58
58
|
}, tr: ReadonlyTransaction) => boolean;
|
|
59
|
+
export declare function findUniqueItemsIn<T>(findIn: Array<T>, checkWith: Array<T>, comparator?: (firstItem: T, secondItem: T) => boolean): Array<T>;
|
|
59
60
|
export {};
|
|
@@ -56,4 +56,5 @@ export declare const isMatchAffectedByStep: (match: Match, step: Step & {
|
|
|
56
56
|
slice: Slice;
|
|
57
57
|
to: number;
|
|
58
58
|
}, tr: ReadonlyTransaction) => boolean;
|
|
59
|
+
export declare function findUniqueItemsIn<T>(findIn: Array<T>, checkWith: Array<T>, comparator?: (firstItem: T, secondItem: T) => boolean): Array<T>;
|
|
59
60
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-find-replace",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.15",
|
|
4
4
|
"description": "find replace plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/primitives": "^18.0.0",
|
|
45
45
|
"@atlaskit/textfield": "^8.2.0",
|
|
46
46
|
"@atlaskit/theme": "^21.0.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^25.0.0",
|
|
48
48
|
"@atlaskit/tokens": "^11.0.0",
|
|
49
49
|
"@atlaskit/tooltip": "^20.14.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.findUniqueItemsIn = findUniqueItemsIn;
|
|
7
|
-
function findUniqueItemsIn(findIn, checkWith, comparator) {
|
|
8
|
-
return findIn.filter(function (firstItem) {
|
|
9
|
-
return checkWith.findIndex(function (secondItem) {
|
|
10
|
-
return comparator ? comparator(firstItem, secondItem) : firstItem === secondItem;
|
|
11
|
-
}) === -1;
|
|
12
|
-
});
|
|
13
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export function findUniqueItemsIn(findIn, checkWith, comparator) {
|
|
2
|
-
return findIn.filter(function (firstItem) {
|
|
3
|
-
return checkWith.findIndex(function (secondItem) {
|
|
4
|
-
return comparator ? comparator(firstItem, secondItem) : firstItem === secondItem;
|
|
5
|
-
}) === -1;
|
|
6
|
-
});
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function findUniqueItemsIn<T>(findIn: Array<T>, checkWith: Array<T>, comparator?: (firstItem: T, secondItem: T) => boolean): Array<T>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function findUniqueItemsIn<T>(findIn: Array<T>, checkWith: Array<T>, comparator?: (firstItem: T, secondItem: T) => boolean): Array<T>;
|