@atlaskit/editor-common 81.2.0 → 81.2.1
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 +9 -0
- package/dist/cjs/mark/commands.js +64 -15
- package/dist/cjs/mark/index.js +6 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/mark/commands.js +54 -1
- package/dist/es2019/mark/index.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/mark/commands.js +61 -14
- package/dist/esm/mark/index.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/mark/commands.d.ts +5 -0
- package/dist/types/mark/index.d.ts +1 -1
- package/dist/types-ts4.5/mark/commands.d.ts +5 -0
- package/dist/types-ts4.5/mark/index.d.ts +1 -1
- package/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 81.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#105074](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/105074)
|
|
8
|
+
[`546eb6455635`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/546eb6455635) -
|
|
9
|
+
[ux] ED-23044 - The inlineCards with URL should be simplified to url when them are wrapped to
|
|
10
|
+
inline codemark
|
|
11
|
+
|
|
3
12
|
## 81.2.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
|
@@ -5,7 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.entireSelectionContainsMark = exports.applyMarkOnRange = void 0;
|
|
7
7
|
exports.filterChildrenBetween = filterChildrenBetween;
|
|
8
|
-
exports.
|
|
8
|
+
exports.toggleMark = exports.removeMark = void 0;
|
|
9
|
+
exports.transformNonTextNodesToText = transformNonTextNodesToText;
|
|
10
|
+
exports.transformSmartCharsMentionsAndEmojis = void 0;
|
|
9
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
12
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
11
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -63,17 +65,64 @@ function filterChildrenBetween(doc, from, to, predicate) {
|
|
|
63
65
|
});
|
|
64
66
|
return results;
|
|
65
67
|
}
|
|
68
|
+
function transformNonTextNodesToText(from, to, tr) {
|
|
69
|
+
var doc = tr.doc;
|
|
70
|
+
var schema = doc.type.schema;
|
|
71
|
+
var _schema$nodes2 = schema.nodes,
|
|
72
|
+
mentionNodeType = _schema$nodes2.mention,
|
|
73
|
+
textNodeType = _schema$nodes2.text,
|
|
74
|
+
emojiNodeType = _schema$nodes2.emoji,
|
|
75
|
+
inlineCardNodeType = _schema$nodes2.inlineCard;
|
|
76
|
+
var nodesToChange = [];
|
|
77
|
+
doc.nodesBetween(from, to, function (node, pos, parent) {
|
|
78
|
+
if ([mentionNodeType, textNodeType, emojiNodeType, inlineCardNodeType].includes(node.type)) {
|
|
79
|
+
nodesToChange.push({
|
|
80
|
+
node: node,
|
|
81
|
+
pos: pos
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
nodesToChange.forEach(function (_ref) {
|
|
86
|
+
var node = _ref.node,
|
|
87
|
+
pos = _ref.pos;
|
|
88
|
+
if (node.type !== textNodeType) {
|
|
89
|
+
var newText = node.attrs.url ||
|
|
90
|
+
// url for inlineCard
|
|
91
|
+
node.attrs.text || "".concat(node.type.name, " text missing"); // fallback for missing text
|
|
92
|
+
|
|
93
|
+
var currentPos = tr.mapping.map(pos);
|
|
94
|
+
tr.replaceWith(currentPos, currentPos + node.nodeSize, schema.text(newText, node.marks));
|
|
95
|
+
} else if (node.text) {
|
|
96
|
+
// Find a valid start and end position because the text may be partially selected.
|
|
97
|
+
var startPositionInSelection = Math.max(pos, from);
|
|
98
|
+
var endPositionInSelection = Math.min(pos + node.nodeSize, to);
|
|
99
|
+
var textForReplacing = doc.textBetween(startPositionInSelection, endPositionInSelection);
|
|
100
|
+
var _newText = textForReplacing.replace(FIND_SMART_CHAR, function (match) {
|
|
101
|
+
var _SMART_TO_ASCII$match;
|
|
102
|
+
return (_SMART_TO_ASCII$match = SMART_TO_ASCII[match]) !== null && _SMART_TO_ASCII$match !== void 0 ? _SMART_TO_ASCII$match : match;
|
|
103
|
+
});
|
|
104
|
+
var currentStartPos = tr.mapping.map(startPositionInSelection);
|
|
105
|
+
var currentEndPos = tr.mapping.map(endPositionInSelection);
|
|
106
|
+
tr.replaceWith(currentStartPos, currentEndPos, schema.text(_newText, node.marks));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @private
|
|
113
|
+
* @deprecated Use {@link transformNonTextNodesToText} instead.
|
|
114
|
+
*/
|
|
66
115
|
var transformSmartCharsMentionsAndEmojis = exports.transformSmartCharsMentionsAndEmojis = function transformSmartCharsMentionsAndEmojis(from, to, tr) {
|
|
67
116
|
var schema = tr.doc.type.schema;
|
|
68
|
-
var _schema$
|
|
69
|
-
mention = _schema$
|
|
70
|
-
text = _schema$
|
|
71
|
-
emoji = _schema$
|
|
117
|
+
var _schema$nodes3 = schema.nodes,
|
|
118
|
+
mention = _schema$nodes3.mention,
|
|
119
|
+
text = _schema$nodes3.text,
|
|
120
|
+
emoji = _schema$nodes3.emoji;
|
|
72
121
|
// Traverse through all the nodes within the range and replace them with their plaintext counterpart
|
|
73
122
|
var children = filterChildrenBetween(tr.doc, from, to, isNodeTextBlock(schema));
|
|
74
|
-
children.forEach(function (
|
|
75
|
-
var node =
|
|
76
|
-
pos =
|
|
123
|
+
children.forEach(function (_ref2) {
|
|
124
|
+
var node = _ref2.node,
|
|
125
|
+
pos = _ref2.pos;
|
|
77
126
|
if (node.type === mention || node.type === emoji) {
|
|
78
127
|
// Convert gracefully when no text found, ProseMirror will blow up if you try to create a node with an empty string or undefined
|
|
79
128
|
var replacementText = node.attrs.text;
|
|
@@ -93,7 +142,7 @@ var applyMarkOnRange = exports.applyMarkOnRange = function applyMarkOnRange(from
|
|
|
93
142
|
var code = schema.marks.code;
|
|
94
143
|
var inlineCard = schema.nodes.inlineCard;
|
|
95
144
|
if (mark.type === code) {
|
|
96
|
-
transformSmartCharsMentionsAndEmojis(from, to, tr);
|
|
145
|
+
(0, _platformFeatureFlags.getBooleanFF)('platform.editor.simplify-inline-cards-in-code-blocks_jw6t1') ? transformNonTextNodesToText(from, to, tr) : transformSmartCharsMentionsAndEmojis(from, to, tr);
|
|
97
146
|
}
|
|
98
147
|
tr.doc.nodesBetween(tr.mapping.map(from), tr.mapping.map(to), function (node, pos) {
|
|
99
148
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
@@ -135,8 +184,8 @@ var entireSelectionContainsMark = exports.entireSelectionContainsMark = function
|
|
|
135
184
|
return onlyContainsMark;
|
|
136
185
|
};
|
|
137
186
|
var toggleMarkInRange = function toggleMarkInRange(mark) {
|
|
138
|
-
return function (
|
|
139
|
-
var tr =
|
|
187
|
+
return function (_ref3) {
|
|
188
|
+
var tr = _ref3.tr;
|
|
140
189
|
if (tr.selection instanceof _cellSelection.CellSelection) {
|
|
141
190
|
var _removeMark = true;
|
|
142
191
|
var cells = [];
|
|
@@ -181,8 +230,8 @@ var toggleMarkInRange = function toggleMarkInRange(mark) {
|
|
|
181
230
|
* @param attrs
|
|
182
231
|
*/
|
|
183
232
|
var toggleMark = exports.toggleMark = function toggleMark(markType, attrs) {
|
|
184
|
-
return function (
|
|
185
|
-
var tr =
|
|
233
|
+
return function (_ref4) {
|
|
234
|
+
var tr = _ref4.tr;
|
|
186
235
|
var mark = markType.create(attrs);
|
|
187
236
|
|
|
188
237
|
// For cursor selections we can use the default behaviour.
|
|
@@ -204,8 +253,8 @@ var toggleMark = exports.toggleMark = function toggleMark(markType, attrs) {
|
|
|
204
253
|
* A wrapper around ProseMirror removeMark and removeStoredMark, which handles mark removal in text, CellSelections and cursor stored marks.
|
|
205
254
|
*/
|
|
206
255
|
var removeMark = exports.removeMark = function removeMark(mark) {
|
|
207
|
-
return function (
|
|
208
|
-
var tr =
|
|
256
|
+
return function (_ref5) {
|
|
257
|
+
var tr = _ref5.tr;
|
|
209
258
|
var selection = tr.selection;
|
|
210
259
|
if (selection instanceof _cellSelection.CellSelection) {
|
|
211
260
|
selection.forEachCell(function (cell, cellPos) {
|
package/dist/cjs/mark/index.js
CHANGED
|
@@ -51,6 +51,12 @@ Object.defineProperty(exports, "toggleMark", {
|
|
|
51
51
|
return _commands.toggleMark;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
+
Object.defineProperty(exports, "transformNonTextNodesToText", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _commands.transformNonTextNodesToText;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
54
60
|
Object.defineProperty(exports, "transformSmartCharsMentionsAndEmojis", {
|
|
55
61
|
enumerable: true,
|
|
56
62
|
get: function get() {
|
|
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "81.2.
|
|
19
|
+
var packageVersion = "81.2.1";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -20,7 +20,7 @@ var _Layer = _interopRequireDefault(require("../Layer"));
|
|
|
20
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
21
21
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "81.2.
|
|
23
|
+
var packageVersion = "81.2.1";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -61,6 +61,59 @@ export function filterChildrenBetween(doc, from, to, predicate) {
|
|
|
61
61
|
});
|
|
62
62
|
return results;
|
|
63
63
|
}
|
|
64
|
+
export function transformNonTextNodesToText(from, to, tr) {
|
|
65
|
+
const {
|
|
66
|
+
doc
|
|
67
|
+
} = tr;
|
|
68
|
+
const {
|
|
69
|
+
schema
|
|
70
|
+
} = doc.type;
|
|
71
|
+
const {
|
|
72
|
+
mention: mentionNodeType,
|
|
73
|
+
text: textNodeType,
|
|
74
|
+
emoji: emojiNodeType,
|
|
75
|
+
inlineCard: inlineCardNodeType
|
|
76
|
+
} = schema.nodes;
|
|
77
|
+
const nodesToChange = [];
|
|
78
|
+
doc.nodesBetween(from, to, (node, pos, parent) => {
|
|
79
|
+
if ([mentionNodeType, textNodeType, emojiNodeType, inlineCardNodeType].includes(node.type)) {
|
|
80
|
+
nodesToChange.push({
|
|
81
|
+
node,
|
|
82
|
+
pos
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
nodesToChange.forEach(({
|
|
87
|
+
node,
|
|
88
|
+
pos
|
|
89
|
+
}) => {
|
|
90
|
+
if (node.type !== textNodeType) {
|
|
91
|
+
const newText = node.attrs.url ||
|
|
92
|
+
// url for inlineCard
|
|
93
|
+
node.attrs.text || `${node.type.name} text missing`; // fallback for missing text
|
|
94
|
+
|
|
95
|
+
const currentPos = tr.mapping.map(pos);
|
|
96
|
+
tr.replaceWith(currentPos, currentPos + node.nodeSize, schema.text(newText, node.marks));
|
|
97
|
+
} else if (node.text) {
|
|
98
|
+
// Find a valid start and end position because the text may be partially selected.
|
|
99
|
+
const startPositionInSelection = Math.max(pos, from);
|
|
100
|
+
const endPositionInSelection = Math.min(pos + node.nodeSize, to);
|
|
101
|
+
const textForReplacing = doc.textBetween(startPositionInSelection, endPositionInSelection);
|
|
102
|
+
const newText = textForReplacing.replace(FIND_SMART_CHAR, match => {
|
|
103
|
+
var _SMART_TO_ASCII$match;
|
|
104
|
+
return (_SMART_TO_ASCII$match = SMART_TO_ASCII[match]) !== null && _SMART_TO_ASCII$match !== void 0 ? _SMART_TO_ASCII$match : match;
|
|
105
|
+
});
|
|
106
|
+
const currentStartPos = tr.mapping.map(startPositionInSelection);
|
|
107
|
+
const currentEndPos = tr.mapping.map(endPositionInSelection);
|
|
108
|
+
tr.replaceWith(currentStartPos, currentEndPos, schema.text(newText, node.marks));
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @private
|
|
115
|
+
* @deprecated Use {@link transformNonTextNodesToText} instead.
|
|
116
|
+
*/
|
|
64
117
|
export const transformSmartCharsMentionsAndEmojis = (from, to, tr) => {
|
|
65
118
|
const {
|
|
66
119
|
schema
|
|
@@ -101,7 +154,7 @@ export const applyMarkOnRange = (from, to, removeMark, mark, tr) => {
|
|
|
101
154
|
inlineCard
|
|
102
155
|
} = schema.nodes;
|
|
103
156
|
if (mark.type === code) {
|
|
104
|
-
transformSmartCharsMentionsAndEmojis(from, to, tr);
|
|
157
|
+
getBooleanFF('platform.editor.simplify-inline-cards-in-code-blocks_jw6t1') ? transformNonTextNodesToText(from, to, tr) : transformSmartCharsMentionsAndEmojis(from, to, tr);
|
|
105
158
|
}
|
|
106
159
|
tr.doc.nodesBetween(tr.mapping.map(from), tr.mapping.map(to), (node, pos) => {
|
|
107
160
|
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { transformSmartCharsMentionsAndEmojis, applyMarkOnRange, filterChildrenBetween, toggleMark, removeMark, entireSelectionContainsMark } from './commands';
|
|
1
|
+
export { transformSmartCharsMentionsAndEmojis, transformNonTextNodesToText, applyMarkOnRange, filterChildrenBetween, toggleMark, removeMark, entireSelectionContainsMark } from './commands';
|
|
2
2
|
export { anyMarkActive, isMarkAllowedInRange, isMarkExcluded } from './text-formatting';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
2
2
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
3
|
-
const packageVersion = "81.2.
|
|
3
|
+
const packageVersion = "81.2.1";
|
|
4
4
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
5
5
|
// Remove URL as it has UGC
|
|
6
6
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
7
7
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
8
8
|
import Layer from '../Layer';
|
|
9
9
|
const packageName = "@atlaskit/editor-common";
|
|
10
|
-
const packageVersion = "81.2.
|
|
10
|
+
const packageVersion = "81.2.1";
|
|
11
11
|
const halfFocusRing = 1;
|
|
12
12
|
const dropOffset = '0, 8';
|
|
13
13
|
class DropList extends Component {
|
|
@@ -55,17 +55,64 @@ export function filterChildrenBetween(doc, from, to, predicate) {
|
|
|
55
55
|
});
|
|
56
56
|
return results;
|
|
57
57
|
}
|
|
58
|
+
export function transformNonTextNodesToText(from, to, tr) {
|
|
59
|
+
var doc = tr.doc;
|
|
60
|
+
var schema = doc.type.schema;
|
|
61
|
+
var _schema$nodes2 = schema.nodes,
|
|
62
|
+
mentionNodeType = _schema$nodes2.mention,
|
|
63
|
+
textNodeType = _schema$nodes2.text,
|
|
64
|
+
emojiNodeType = _schema$nodes2.emoji,
|
|
65
|
+
inlineCardNodeType = _schema$nodes2.inlineCard;
|
|
66
|
+
var nodesToChange = [];
|
|
67
|
+
doc.nodesBetween(from, to, function (node, pos, parent) {
|
|
68
|
+
if ([mentionNodeType, textNodeType, emojiNodeType, inlineCardNodeType].includes(node.type)) {
|
|
69
|
+
nodesToChange.push({
|
|
70
|
+
node: node,
|
|
71
|
+
pos: pos
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
nodesToChange.forEach(function (_ref) {
|
|
76
|
+
var node = _ref.node,
|
|
77
|
+
pos = _ref.pos;
|
|
78
|
+
if (node.type !== textNodeType) {
|
|
79
|
+
var newText = node.attrs.url ||
|
|
80
|
+
// url for inlineCard
|
|
81
|
+
node.attrs.text || "".concat(node.type.name, " text missing"); // fallback for missing text
|
|
82
|
+
|
|
83
|
+
var currentPos = tr.mapping.map(pos);
|
|
84
|
+
tr.replaceWith(currentPos, currentPos + node.nodeSize, schema.text(newText, node.marks));
|
|
85
|
+
} else if (node.text) {
|
|
86
|
+
// Find a valid start and end position because the text may be partially selected.
|
|
87
|
+
var startPositionInSelection = Math.max(pos, from);
|
|
88
|
+
var endPositionInSelection = Math.min(pos + node.nodeSize, to);
|
|
89
|
+
var textForReplacing = doc.textBetween(startPositionInSelection, endPositionInSelection);
|
|
90
|
+
var _newText = textForReplacing.replace(FIND_SMART_CHAR, function (match) {
|
|
91
|
+
var _SMART_TO_ASCII$match;
|
|
92
|
+
return (_SMART_TO_ASCII$match = SMART_TO_ASCII[match]) !== null && _SMART_TO_ASCII$match !== void 0 ? _SMART_TO_ASCII$match : match;
|
|
93
|
+
});
|
|
94
|
+
var currentStartPos = tr.mapping.map(startPositionInSelection);
|
|
95
|
+
var currentEndPos = tr.mapping.map(endPositionInSelection);
|
|
96
|
+
tr.replaceWith(currentStartPos, currentEndPos, schema.text(_newText, node.marks));
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @private
|
|
103
|
+
* @deprecated Use {@link transformNonTextNodesToText} instead.
|
|
104
|
+
*/
|
|
58
105
|
export var transformSmartCharsMentionsAndEmojis = function transformSmartCharsMentionsAndEmojis(from, to, tr) {
|
|
59
106
|
var schema = tr.doc.type.schema;
|
|
60
|
-
var _schema$
|
|
61
|
-
mention = _schema$
|
|
62
|
-
text = _schema$
|
|
63
|
-
emoji = _schema$
|
|
107
|
+
var _schema$nodes3 = schema.nodes,
|
|
108
|
+
mention = _schema$nodes3.mention,
|
|
109
|
+
text = _schema$nodes3.text,
|
|
110
|
+
emoji = _schema$nodes3.emoji;
|
|
64
111
|
// Traverse through all the nodes within the range and replace them with their plaintext counterpart
|
|
65
112
|
var children = filterChildrenBetween(tr.doc, from, to, isNodeTextBlock(schema));
|
|
66
|
-
children.forEach(function (
|
|
67
|
-
var node =
|
|
68
|
-
pos =
|
|
113
|
+
children.forEach(function (_ref2) {
|
|
114
|
+
var node = _ref2.node,
|
|
115
|
+
pos = _ref2.pos;
|
|
69
116
|
if (node.type === mention || node.type === emoji) {
|
|
70
117
|
// Convert gracefully when no text found, ProseMirror will blow up if you try to create a node with an empty string or undefined
|
|
71
118
|
var replacementText = node.attrs.text;
|
|
@@ -85,7 +132,7 @@ export var applyMarkOnRange = function applyMarkOnRange(from, to, removeMark, ma
|
|
|
85
132
|
var code = schema.marks.code;
|
|
86
133
|
var inlineCard = schema.nodes.inlineCard;
|
|
87
134
|
if (mark.type === code) {
|
|
88
|
-
transformSmartCharsMentionsAndEmojis(from, to, tr);
|
|
135
|
+
getBooleanFF('platform.editor.simplify-inline-cards-in-code-blocks_jw6t1') ? transformNonTextNodesToText(from, to, tr) : transformSmartCharsMentionsAndEmojis(from, to, tr);
|
|
89
136
|
}
|
|
90
137
|
tr.doc.nodesBetween(tr.mapping.map(from), tr.mapping.map(to), function (node, pos) {
|
|
91
138
|
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes')) {
|
|
@@ -127,8 +174,8 @@ export var entireSelectionContainsMark = function entireSelectionContainsMark(ma
|
|
|
127
174
|
return onlyContainsMark;
|
|
128
175
|
};
|
|
129
176
|
var toggleMarkInRange = function toggleMarkInRange(mark) {
|
|
130
|
-
return function (
|
|
131
|
-
var tr =
|
|
177
|
+
return function (_ref3) {
|
|
178
|
+
var tr = _ref3.tr;
|
|
132
179
|
if (tr.selection instanceof CellSelection) {
|
|
133
180
|
var _removeMark = true;
|
|
134
181
|
var cells = [];
|
|
@@ -173,8 +220,8 @@ var toggleMarkInRange = function toggleMarkInRange(mark) {
|
|
|
173
220
|
* @param attrs
|
|
174
221
|
*/
|
|
175
222
|
export var toggleMark = function toggleMark(markType, attrs) {
|
|
176
|
-
return function (
|
|
177
|
-
var tr =
|
|
223
|
+
return function (_ref4) {
|
|
224
|
+
var tr = _ref4.tr;
|
|
178
225
|
var mark = markType.create(attrs);
|
|
179
226
|
|
|
180
227
|
// For cursor selections we can use the default behaviour.
|
|
@@ -196,8 +243,8 @@ export var toggleMark = function toggleMark(markType, attrs) {
|
|
|
196
243
|
* A wrapper around ProseMirror removeMark and removeStoredMark, which handles mark removal in text, CellSelections and cursor stored marks.
|
|
197
244
|
*/
|
|
198
245
|
export var removeMark = function removeMark(mark) {
|
|
199
|
-
return function (
|
|
200
|
-
var tr =
|
|
246
|
+
return function (_ref5) {
|
|
247
|
+
var tr = _ref5.tr;
|
|
201
248
|
var selection = tr.selection;
|
|
202
249
|
if (selection instanceof CellSelection) {
|
|
203
250
|
selection.forEachCell(function (cell, cellPos) {
|
package/dist/esm/mark/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { transformSmartCharsMentionsAndEmojis, applyMarkOnRange, filterChildrenBetween, toggleMark, removeMark, entireSelectionContainsMark } from './commands';
|
|
1
|
+
export { transformSmartCharsMentionsAndEmojis, transformNonTextNodesToText, applyMarkOnRange, filterChildrenBetween, toggleMark, removeMark, entireSelectionContainsMark } from './commands';
|
|
2
2
|
export { anyMarkActive, isMarkAllowedInRange, isMarkExcluded } from './text-formatting';
|
|
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
6
6
|
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) { _defineProperty(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; }
|
|
7
7
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
8
8
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
9
|
-
var packageVersion = "81.2.
|
|
9
|
+
var packageVersion = "81.2.1";
|
|
10
10
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
11
11
|
// Remove URL as it has UGC
|
|
12
12
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -15,7 +15,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
|
|
|
15
15
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
16
16
|
import Layer from '../Layer';
|
|
17
17
|
var packageName = "@atlaskit/editor-common";
|
|
18
|
-
var packageVersion = "81.2.
|
|
18
|
+
var packageVersion = "81.2.1";
|
|
19
19
|
var halfFocusRing = 1;
|
|
20
20
|
var dropOffset = '0, 8';
|
|
21
21
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -5,6 +5,11 @@ export declare function filterChildrenBetween(doc: PMNode, from: number, to: num
|
|
|
5
5
|
node: PMNode;
|
|
6
6
|
pos: number;
|
|
7
7
|
}[];
|
|
8
|
+
export declare function transformNonTextNodesToText(from: number, to: number, tr: Transaction): void;
|
|
9
|
+
/**
|
|
10
|
+
* @private
|
|
11
|
+
* @deprecated Use {@link transformNonTextNodesToText} instead.
|
|
12
|
+
*/
|
|
8
13
|
export declare const transformSmartCharsMentionsAndEmojis: (from: number, to: number, tr: Transaction) => void;
|
|
9
14
|
export declare const applyMarkOnRange: (from: number, to: number, removeMark: boolean, mark: Mark, tr: Transaction) => Transaction;
|
|
10
15
|
export declare const entireSelectionContainsMark: (mark: Mark | MarkType, doc: PMNode, fromPos: number, toPos: number) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { transformSmartCharsMentionsAndEmojis, applyMarkOnRange, filterChildrenBetween, toggleMark, removeMark, entireSelectionContainsMark, } from './commands';
|
|
1
|
+
export { transformSmartCharsMentionsAndEmojis, transformNonTextNodesToText, applyMarkOnRange, filterChildrenBetween, toggleMark, removeMark, entireSelectionContainsMark, } from './commands';
|
|
2
2
|
export { anyMarkActive, isMarkAllowedInRange, isMarkExcluded } from './text-formatting';
|
|
@@ -5,6 +5,11 @@ export declare function filterChildrenBetween(doc: PMNode, from: number, to: num
|
|
|
5
5
|
node: PMNode;
|
|
6
6
|
pos: number;
|
|
7
7
|
}[];
|
|
8
|
+
export declare function transformNonTextNodesToText(from: number, to: number, tr: Transaction): void;
|
|
9
|
+
/**
|
|
10
|
+
* @private
|
|
11
|
+
* @deprecated Use {@link transformNonTextNodesToText} instead.
|
|
12
|
+
*/
|
|
8
13
|
export declare const transformSmartCharsMentionsAndEmojis: (from: number, to: number, tr: Transaction) => void;
|
|
9
14
|
export declare const applyMarkOnRange: (from: number, to: number, removeMark: boolean, mark: Mark, tr: Transaction) => Transaction;
|
|
10
15
|
export declare const entireSelectionContainsMark: (mark: Mark | MarkType, doc: PMNode, fromPos: number, toPos: number) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { transformSmartCharsMentionsAndEmojis, applyMarkOnRange, filterChildrenBetween, toggleMark, removeMark, entireSelectionContainsMark, } from './commands';
|
|
1
|
+
export { transformSmartCharsMentionsAndEmojis, transformNonTextNodesToText, applyMarkOnRange, filterChildrenBetween, toggleMark, removeMark, entireSelectionContainsMark, } from './commands';
|
|
2
2
|
export { anyMarkActive, isMarkAllowedInRange, isMarkExcluded } from './text-formatting';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "81.2.
|
|
3
|
+
"version": "81.2.1",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -247,6 +247,9 @@
|
|
|
247
247
|
},
|
|
248
248
|
"platform.editor.explicit-html-element-check": {
|
|
249
249
|
"type": "boolean"
|
|
250
|
+
},
|
|
251
|
+
"platform.editor.simplify-inline-cards-in-code-blocks_jw6t1": {
|
|
252
|
+
"type": "boolean"
|
|
250
253
|
}
|
|
251
254
|
}
|
|
252
255
|
}
|