Block Editor: Additional package updates.

Built from https://develop.svn.wordpress.org/branches/5.1@51834


git-svn-id: http://core.svn.wordpress.org/branches/5.1@51441 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2021-09-21 16:54:46 +00:00
parent 15135a859f
commit 0fa98b27df
5 changed files with 79 additions and 36 deletions

View File

@ -16091,6 +16091,7 @@ function (_Component) {
value: function getRecord() { value: function getRecord() {
var _this$formatToValue = this.formatToValue(this.props.value), var _this$formatToValue = this.formatToValue(this.props.value),
formats = _this$formatToValue.formats, formats = _this$formatToValue.formats,
replacements = _this$formatToValue.replacements,
text = _this$formatToValue.text; text = _this$formatToValue.text;
var _this$state = this.state, var _this$state = this.state,
@ -16100,7 +16101,8 @@ function (_Component) {
formats: formats, formats: formats,
text: text, text: text,
start: start, start: start,
end: end end: end,
replacements: replacements
}; };
} }
}, { }, {

File diff suppressed because one or more lines are too long

View File

@ -976,7 +976,8 @@ function normaliseFormats(_ref) {
var formats = _ref.formats, var formats = _ref.formats,
text = _ref.text, text = _ref.text,
start = _ref.start, start = _ref.start,
end = _ref.end; end = _ref.end,
replacements = _ref.replacements;
var refs = []; var refs = [];
var newFormats = formats.map(function (formatsAtIndex) { var newFormats = formats.map(function (formatsAtIndex) {
return formatsAtIndex.map(function (format) { return formatsAtIndex.map(function (format) {
@ -996,7 +997,8 @@ function normaliseFormats(_ref) {
formats: newFormats, formats: newFormats,
text: text, text: text,
start: start, start: start,
end: end end: end,
replacements: replacements
}; };
} }
@ -1027,7 +1029,8 @@ function applyFormat(_ref, format) {
var formats = _ref.formats, var formats = _ref.formats,
text = _ref.text, text = _ref.text,
start = _ref.start, start = _ref.start,
end = _ref.end; end = _ref.end,
replacements = _ref.replacements;
var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : start; var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : start;
var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : end; var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : end;
var newFormats = formats.slice(0); // The selection is collpased. var newFormats = formats.slice(0); // The selection is collpased.
@ -1062,6 +1065,7 @@ function applyFormat(_ref, format) {
text: text, text: text,
start: start, start: start,
end: end, end: end,
replacements: replacements,
formatPlaceholder: { formatPlaceholder: {
index: startIndex, index: startIndex,
format: hasType ? undefined : format format: hasType ? undefined : format
@ -1078,7 +1082,8 @@ function applyFormat(_ref, format) {
formats: newFormats, formats: newFormats,
text: text, text: text,
start: start, start: start,
end: end end: end,
replacements: replacements
}); });
} }
@ -1253,6 +1258,7 @@ var _window$Node = window.Node,
function createEmptyValue() { function createEmptyValue() {
return { return {
formats: [], formats: [],
replacements: [],
text: '' text: ''
}; };
} }
@ -1367,6 +1373,7 @@ function create() {
if (typeof text === 'string' && text.length > 0) { if (typeof text === 'string' && text.length > 0) {
return { return {
formats: Array(text.length), formats: Array(text.length),
replacements: Array(text.length),
text: text text: text
}; };
} }
@ -1559,6 +1566,7 @@ function createFromElement(_ref3) {
// formats can be added. // formats can be added.
accumulator.formats.length += _text.length; accumulator.formats.length += _text.length;
accumulator.replacements.length += _text.length;
continue; continue;
} }
@ -1583,7 +1591,9 @@ function createFromElement(_ref3) {
text: OBJECT_REPLACEMENT_CHARACTER text: OBJECT_REPLACEMENT_CHARACTER
}; };
accumulateSelection(accumulator, node, range, _value); accumulateSelection(accumulator, node, range, _value);
mergePair(accumulator, _value); accumulator.formats.length += 1;
accumulator.replacements = accumulator.replacements.concat(_value.replacements);
accumulator.text += OBJECT_REPLACEMENT_CHARACTER;
continue; continue;
} }
@ -1591,6 +1601,7 @@ function createFromElement(_ref3) {
accumulateSelection(accumulator, node, range, createEmptyValue()); accumulateSelection(accumulator, node, range, createEmptyValue());
accumulator.text += '\n'; accumulator.text += '\n';
accumulator.formats.length += 1; accumulator.formats.length += 1;
accumulator.replacements.length += 1;
continue; continue;
} }
@ -1655,17 +1666,20 @@ function createFromElement(_ref3) {
var formats = accumulator.formats; var formats = accumulator.formats;
if (format && format.attributes && text.length === 0) { if (format && format.attributes && text.length === 0) {
var lastReplacement = accumulator.replacements[accumulator.replacements.length - 1];
format.object = true; format.object = true;
accumulator.text += OBJECT_REPLACEMENT_CHARACTER;
if (formats[start]) { if (isFormatEqual(lastReplacement, format)) {
formats[start].unshift(format); return accumulator;
} else {
formats[start] = [format];
} }
accumulator.text += OBJECT_REPLACEMENT_CHARACTER;
accumulator.replacements.push(format);
accumulator.formats.length += 1;
} else { } else {
accumulator.text += text; accumulator.text += text;
accumulator.formats.length += text.length; accumulator.formats.length += text.length;
accumulator.replacements.length += text.length;
var i = value.formats.length; // Optimise for speed. var i = value.formats.length; // Optimise for speed.
while (i--) { while (i--) {
@ -1688,6 +1702,10 @@ function createFromElement(_ref3) {
formats[formatIndex] = value.formats[i]; formats[formatIndex] = value.formats[i];
} }
} }
if (value.replacements[i]) {
accumulator.replacements[formatIndex] = value.replacements[i];
}
} }
} }
} }
@ -1777,11 +1795,13 @@ function createFromMultilineElement(_ref4) {
if (index !== 0 || currentWrapperTags.length > 0) { if (index !== 0 || currentWrapperTags.length > 0) {
var formats = currentWrapperTags.length > 0 ? [currentWrapperTags] : [,]; var formats = currentWrapperTags.length > 0 ? [currentWrapperTags] : [,];
accumulator.formats = accumulator.formats.concat(formats); accumulator.formats = accumulator.formats.concat(formats);
accumulator.replacements.length += 1;
accumulator.text += LINE_SEPARATOR; accumulator.text += LINE_SEPARATOR;
} }
accumulateSelection(accumulator, node, range, value); accumulateSelection(accumulator, node, range, value);
accumulator.formats = accumulator.formats.concat(value.formats); accumulator.formats = accumulator.formats.concat(value.formats);
accumulator.replacements = accumulator.replacements.concat(value.replacements);
accumulator.text += value.text; accumulator.text += value.text;
} }
@ -2190,7 +2210,8 @@ function removeFormat(_ref, formatType) {
var formats = _ref.formats, var formats = _ref.formats,
text = _ref.text, text = _ref.text,
start = _ref.start, start = _ref.start,
end = _ref.end; end = _ref.end,
replacements = _ref.replacements;
var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : start; var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : start;
var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : end; var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : end;
var newFormats = formats.slice(0); // If the selection is collapsed, expand start and end to the edges of the var newFormats = formats.slice(0); // If the selection is collapsed, expand start and end to the edges of the
@ -2224,7 +2245,8 @@ function removeFormat(_ref, formatType) {
formats: newFormats, formats: newFormats,
text: text, text: text,
start: start, start: start,
end: end end: end,
replacements: replacements
}); });
} }
@ -2265,7 +2287,8 @@ function insert(_ref, valueToInsert) {
var formats = _ref.formats, var formats = _ref.formats,
text = _ref.text, text = _ref.text,
start = _ref.start, start = _ref.start,
end = _ref.end; end = _ref.end,
replacements = _ref.replacements;
var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : start; var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : start;
var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : end; var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : end;
@ -2279,6 +2302,7 @@ function insert(_ref, valueToInsert) {
return normaliseFormats({ return normaliseFormats({
formats: formats.slice(0, startIndex).concat(valueToInsert.formats, formats.slice(endIndex)), formats: formats.slice(0, startIndex).concat(valueToInsert.formats, formats.slice(endIndex)),
text: text.slice(0, startIndex) + valueToInsert.text + text.slice(endIndex), text: text.slice(0, startIndex) + valueToInsert.text + text.slice(endIndex),
replacements: replacements.slice(0, startIndex).concat(valueToInsert.replacements, replacements.slice(endIndex)),
start: index, start: index,
end: index end: index
}); });
@ -2333,7 +2357,8 @@ function replace(_ref, pattern, replacement) {
var formats = _ref.formats, var formats = _ref.formats,
text = _ref.text, text = _ref.text,
start = _ref.start, start = _ref.start,
end = _ref.end; end = _ref.end,
replacements = _ref.replacements;
text = text.replace(pattern, function (match) { text = text.replace(pattern, function (match) {
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
rest[_key - 1] = arguments[_key]; rest[_key - 1] = arguments[_key];
@ -2342,6 +2367,7 @@ function replace(_ref, pattern, replacement) {
var offset = rest[rest.length - 2]; var offset = rest[rest.length - 2];
var newText = replacement; var newText = replacement;
var newFormats; var newFormats;
var newReplacements;
if (typeof newText === 'function') { if (typeof newText === 'function') {
newText = replacement.apply(void 0, [match].concat(rest)); newText = replacement.apply(void 0, [match].concat(rest));
@ -2349,9 +2375,11 @@ function replace(_ref, pattern, replacement) {
if (Object(esm_typeof["a" /* default */])(newText) === 'object') { if (Object(esm_typeof["a" /* default */])(newText) === 'object') {
newFormats = newText.formats; newFormats = newText.formats;
newReplacements = newText.replacements;
newText = newText.text; newText = newText.text;
} else { } else {
newFormats = Array(newText.length); newFormats = Array(newText.length);
newReplacements = Array(newText.length);
if (formats[offset]) { if (formats[offset]) {
newFormats = newFormats.fill(formats[offset]); newFormats = newFormats.fill(formats[offset]);
@ -2359,6 +2387,7 @@ function replace(_ref, pattern, replacement) {
} }
formats = formats.slice(0, offset).concat(newFormats, formats.slice(offset + match.length)); formats = formats.slice(0, offset).concat(newFormats, formats.slice(offset + match.length));
replacements = replacements.slice(0, offset).concat(newReplacements, replacements.slice(offset + match.length));
if (start) { if (start) {
start = end = offset + newText.length; start = end = offset + newText.length;
@ -2368,6 +2397,7 @@ function replace(_ref, pattern, replacement) {
}); });
return normaliseFormats({ return normaliseFormats({
formats: formats, formats: formats,
replacements: replacements,
text: text, text: text,
start: start, start: start,
end: end end: end
@ -2407,6 +2437,7 @@ function insertLineSeparator(value) {
var valueToInsert = { var valueToInsert = {
formats: formats, formats: formats,
replacements: [,],
text: LINE_SEPARATOR text: LINE_SEPARATOR
}; };
return insert(value, valueToInsert, startIndex, endIndex); return insert(value, valueToInsert, startIndex, endIndex);
@ -2436,9 +2467,10 @@ var insert_object_OBJECT_REPLACEMENT_CHARACTER = "\uFFFC";
function insertObject(value, formatToInsert, startIndex, endIndex) { function insertObject(value, formatToInsert, startIndex, endIndex) {
var valueToInsert = { var valueToInsert = {
text: insert_object_OBJECT_REPLACEMENT_CHARACTER, text: insert_object_OBJECT_REPLACEMENT_CHARACTER,
formats: [[Object(objectSpread["a" /* default */])({}, formatToInsert, { replacements: [Object(objectSpread["a" /* default */])({}, formatToInsert, {
object: true object: true
})]] })],
formats: [,]
}; };
return insert(value, valueToInsert, startIndex, endIndex); return insert(value, valueToInsert, startIndex, endIndex);
} }
@ -2459,19 +2491,22 @@ function slice(_ref) {
var formats = _ref.formats, var formats = _ref.formats,
text = _ref.text, text = _ref.text,
start = _ref.start, start = _ref.start,
end = _ref.end; end = _ref.end,
replacements = _ref.replacements;
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : start; var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : start;
var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : end; var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : end;
if (startIndex === undefined || endIndex === undefined) { if (startIndex === undefined || endIndex === undefined) {
return { return {
formats: formats, formats: formats,
text: text text: text,
replacements: replacements
}; };
} }
return { return {
formats: formats.slice(startIndex, endIndex), formats: formats.slice(startIndex, endIndex),
replacements: replacements.slice(startIndex, endIndex),
text: text.slice(startIndex, endIndex) text: text.slice(startIndex, endIndex)
}; };
} }
@ -2497,7 +2532,8 @@ function split(_ref, string) {
var formats = _ref.formats, var formats = _ref.formats,
text = _ref.text, text = _ref.text,
start = _ref.start, start = _ref.start,
end = _ref.end; end = _ref.end,
replacements = _ref.replacements;
if (typeof string !== 'string') { if (typeof string !== 'string') {
return splitAtSelection.apply(void 0, arguments); return splitAtSelection.apply(void 0, arguments);
@ -2508,6 +2544,7 @@ function split(_ref, string) {
var startIndex = nextStart; var startIndex = nextStart;
var value = { var value = {
formats: formats.slice(startIndex, startIndex + substring.length), formats: formats.slice(startIndex, startIndex + substring.length),
replacements: replacements.slice(startIndex, startIndex + substring.length),
text: substring text: substring
}; };
nextStart += string.length + substring.length; nextStart += string.length + substring.length;
@ -2534,15 +2571,18 @@ function splitAtSelection(_ref2) {
var formats = _ref2.formats, var formats = _ref2.formats,
text = _ref2.text, text = _ref2.text,
start = _ref2.start, start = _ref2.start,
end = _ref2.end; end = _ref2.end,
replacements = _ref2.replacements;
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : start; var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : start;
var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : end; var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : end;
var before = { var before = {
formats: formats.slice(0, startIndex), formats: formats.slice(0, startIndex),
replacements: replacements.slice(0, startIndex),
text: text.slice(0, startIndex) text: text.slice(0, startIndex)
}; };
var after = { var after = {
formats: formats.slice(endIndex), formats: formats.slice(endIndex),
replacements: replacements.slice(endIndex),
text: text.slice(endIndex), text: text.slice(endIndex),
start: 0, start: 0,
end: 0 end: 0
@ -2661,7 +2701,8 @@ function toTree(_ref2) {
text = value.text, text = value.text,
start = value.start, start = value.start,
end = value.end, end = value.end,
formatPlaceholder = value.formatPlaceholder; formatPlaceholder = value.formatPlaceholder,
replacements = value.replacements;
var formatsLength = formats.length + 1; var formatsLength = formats.length + 1;
var tree = createEmpty(); var tree = createEmpty();
var multilineFormat = { var multilineFormat = {

File diff suppressed because one or more lines are too long

View File

@ -226,36 +226,36 @@ function wp_default_packages_scripts( &$scripts ) {
$packages_versions = array( $packages_versions = array(
'api-fetch' => '2.2.8', 'api-fetch' => '2.2.8',
'a11y' => '2.0.2', 'a11y' => '2.0.2',
'annotations' => '1.0.8', 'annotations' => '1.0.10',
'autop' => '2.0.2', 'autop' => '2.0.2',
'blob' => '2.1.0', 'blob' => '2.1.0',
'block-library' => '2.2.18', 'block-library' => '2.2.20',
'block-serialization-default-parser' => '2.0.5', 'block-serialization-default-parser' => '2.0.5',
'blocks' => '6.0.6', 'blocks' => '6.0.8',
'components' => '7.0.8', 'components' => '7.0.10',
'compose' => '3.0.1', 'compose' => '3.0.1',
'core-data' => '2.0.17', 'core-data' => '2.0.17',
'data' => '4.2.1', 'data' => '4.2.1',
'date' => '3.0.1', 'date' => '3.0.1',
'deprecated' => '2.0.5', 'deprecated' => '2.0.5',
'dom' => '2.0.8', 'dom' => '2.0.9',
'dom-ready' => '2.0.2', 'dom-ready' => '2.0.2',
'edit-post' => '3.1.11', 'edit-post' => '3.1.13',
'editor' => '9.0.11', 'editor' => '9.0.13',
'element' => '2.1.9', 'element' => '2.1.9',
'escape-html' => '1.0.1', 'escape-html' => '1.0.1',
'format-library' => '1.2.14', 'format-library' => '1.2.16',
'hooks' => '2.0.5', 'hooks' => '2.0.5',
'html-entities' => '2.0.4', 'html-entities' => '2.0.4',
'i18n' => '3.1.1', 'i18n' => '3.1.1',
'is-shallow-equal' => '1.1.5', 'is-shallow-equal' => '1.1.5',
'keycodes' => '2.0.6', 'keycodes' => '2.0.6',
'list-reusable-blocks' => '1.1.21', 'list-reusable-blocks' => '1.1.23',
'notices' => '1.1.3', 'notices' => '1.1.3',
'nux' => '3.0.9', 'nux' => '3.0.11',
'plugins' => '2.0.10', 'plugins' => '2.0.11',
'redux-routine' => '3.0.4', 'redux-routine' => '3.0.4',
'rich-text' => '3.0.7', 'rich-text' => '3.0.9',
'shortcode' => '2.0.2', 'shortcode' => '2.0.2',
'token-list' => '1.1.0', 'token-list' => '1.1.0',
'url' => '2.3.3', 'url' => '2.3.3',