Block Editor: Update packages to bring a selection of bugfixes in.

Props iseulde, kjellr, aduth, 0mirka00, mcsf, nosolosw, gziolo, jasmussen, talldanwp, notnownikki, swissspidy, jorgefilipecosta, noisysocks.
See https://github.com/WordPress/gutenberg/pull/14796.
Fixes #46801.


Built from https://develop.svn.wordpress.org/trunk@45138


git-svn-id: http://core.svn.wordpress.org/trunk@44947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2019-04-08 06:37:57 +00:00
parent 9a80e2095b
commit 95df8fa792
30 changed files with 470 additions and 508 deletions

View File

@ -697,6 +697,10 @@ body.admin-color-light .block-editor-block-list__insertion-point-indicator{
.block-editor-block-list__block .block-editor-block-contextual-toolbar > * {
pointer-events: auto; }
.block-editor-block-list__block[data-align="full"] .block-editor-block-contextual-toolbar {
right: 0;
left: 0; }
.block-editor-block-list__block.is-focus-mode:not(.is-multi-selected) > .block-editor-block-contextual-toolbar {
margin-right: -28px; }
@ -1741,17 +1745,7 @@ body.admin-color-light .block-editor-block-list__insertion-point-indicator{
.block-editor-rich-text__editable:focus {
outline: none; }
.block-editor-rich-text__editable:focus *[data-rich-text-format-boundary] {
border-radius: 2px;
box-shadow: 0 0 0 1px #e8eaeb;
background: #e8eaeb;
color: #191e23; }
.block-editor-rich-text__editable:focus a[data-rich-text-format-boundary] {
box-shadow: 0 0 0 1px #e5f5fa;
background: #e5f5fa;
color: #006589; }
.block-editor-rich-text__editable:focus code[data-rich-text-format-boundary] {
background: #e8eaeb;
box-shadow: 0 0 0 1px #e8eaeb; }
border-radius: 2px; }
.block-editor-rich-text__editable[data-is-placeholder-visible="true"] {
position: absolute;
top: 0;

File diff suppressed because one or more lines are too long

View File

@ -707,6 +707,10 @@ body.admin-color-light .block-editor-block-list__insertion-point-indicator{
.block-editor-block-list__block .block-editor-block-contextual-toolbar > * {
pointer-events: auto; }
.block-editor-block-list__block[data-align="full"] .block-editor-block-contextual-toolbar {
left: 0;
right: 0; }
.block-editor-block-list__block.is-focus-mode:not(.is-multi-selected) > .block-editor-block-contextual-toolbar {
margin-left: -28px; }
@ -1753,17 +1757,7 @@ body.admin-color-light .block-editor-block-list__insertion-point-indicator{
.block-editor-rich-text__editable:focus {
outline: none; }
.block-editor-rich-text__editable:focus *[data-rich-text-format-boundary] {
border-radius: 2px;
box-shadow: 0 0 0 1px #e8eaeb;
background: #e8eaeb;
color: #191e23; }
.block-editor-rich-text__editable:focus a[data-rich-text-format-boundary] {
box-shadow: 0 0 0 1px #e5f5fa;
background: #e5f5fa;
color: #006589; }
.block-editor-rich-text__editable:focus code[data-rich-text-format-boundary] {
background: #e8eaeb;
box-shadow: 0 0 0 1px #e8eaeb; }
border-radius: 2px; }
.block-editor-rich-text__editable[data-is-placeholder-visible="true"] {
position: absolute;
top: 0;

File diff suppressed because one or more lines are too long

View File

@ -217,11 +217,6 @@
:not(.components-disabled) > .wp-block-columns > .block-editor-inner-blocks > .block-editor-block-list__layout > [data-type="core/column"] > .block-editor-block-list__block-edit > * {
pointer-events: all; }
.wp-block-cover-image .block-editor-rich-text__editable:focus a[data-rich-text-format-boundary],
.wp-block-cover .block-editor-rich-text__editable:focus a[data-rich-text-format-boundary] {
box-shadow: none;
background: rgba(255, 255, 255, 0.3); }
.wp-block-cover-image.components-placeholder h2,
.wp-block-cover.components-placeholder h2 {
color: inherit; }
@ -690,9 +685,6 @@ body.admin-color-light .blocks-gallery-item img:focus, body.admin-color-light .b
.blocks-gallery-item .block-editor-rich-text figcaption a {
color: #fff; }
.blocks-gallery-item .block-editor-rich-text figcaption:focus a[data-rich-text-format-boundary] {
color: rgba(0, 0, 0, 0.2); }
.block-library-gallery-item__inline-menu {
padding: 2px;
position: absolute;

File diff suppressed because one or more lines are too long

View File

@ -218,11 +218,6 @@
:not(.components-disabled) > .wp-block-columns > .block-editor-inner-blocks > .block-editor-block-list__layout > [data-type="core/column"] > .block-editor-block-list__block-edit > * {
pointer-events: all; }
.wp-block-cover-image .block-editor-rich-text__editable:focus a[data-rich-text-format-boundary],
.wp-block-cover .block-editor-rich-text__editable:focus a[data-rich-text-format-boundary] {
box-shadow: none;
background: rgba(255, 255, 255, 0.3); }
.wp-block-cover-image.components-placeholder h2,
.wp-block-cover.components-placeholder h2 {
color: inherit; }
@ -695,9 +690,6 @@ body.admin-color-light .blocks-gallery-item img:focus, body.admin-color-light .b
.blocks-gallery-item .block-editor-rich-text figcaption a {
color: #fff; }
.blocks-gallery-item .block-editor-rich-text figcaption:focus a[data-rich-text-format-boundary] {
color: rgba(0, 0, 0, 0.2); }
.block-library-gallery-item__inline-menu {
padding: 2px;
position: absolute;

File diff suppressed because one or more lines are too long

View File

@ -692,12 +692,9 @@ body.is-fullscreen-mode .edit-post-header {
z-index: -2; }
@media (min-width: 600px) {
.edit-post-sidebar > .components-panel {
overflow: inherit;
overflow: hidden;
height: auto;
max-height: none; } }
@media (min-width: 782px) {
body.is-fullscreen-mode .edit-post-sidebar > .components-panel {
max-height: calc(100vh - 50px); } }
.edit-post-sidebar > .components-panel .components-panel__header {
position: fixed;
z-index: 1;

File diff suppressed because one or more lines are too long

View File

@ -692,12 +692,9 @@ body.is-fullscreen-mode .edit-post-header {
z-index: -2; }
@media (min-width: 600px) {
.edit-post-sidebar > .components-panel {
overflow: inherit;
overflow: hidden;
height: auto;
max-height: none; } }
@media (min-width: 782px) {
body.is-fullscreen-mode .edit-post-sidebar > .components-panel {
max-height: calc(100vh - 50px); } }
.edit-post-sidebar > .components-panel .components-panel__header {
position: fixed;
z-index: 1;

File diff suppressed because one or more lines are too long

View File

@ -322,7 +322,7 @@ var createPreloadingMiddleware = function createPreloadingMiddleware(preloadedDa
if (parse && 'GET' === method && preloadedData[path]) {
return Promise.resolve(preloadedData[path].body);
} else if ('OPTIONS' === method && preloadedData[method][path]) {
} else if ('OPTIONS' === method && preloadedData[method] && preloadedData[method][path]) {
return Promise.resolve(preloadedData[method][path]);
}
}

File diff suppressed because one or more lines are too long

View File

@ -14219,6 +14219,12 @@ var rich_text_window = window,
*/
var INSERTION_INPUT_TYPES_TO_IGNORE = new Set(['insertParagraph', 'insertOrderedList', 'insertUnorderedList', 'insertHorizontalRule', 'insertLink']);
/**
* Global stylesheet.
*/
var globalStyle = document.createElement('style');
document.head.appendChild(globalStyle);
var rich_text_RichText =
/*#__PURE__*/
function (_Component) {
@ -14274,7 +14280,7 @@ function (_Component) {
_this.handleHorizontalNavigation = _this.handleHorizontalNavigation.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this)));
_this.onPointerDown = _this.onPointerDown.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this)));
_this.formatToValue = memize_default()(_this.formatToValue.bind(Object(assertThisInitialized["a" /* default */])(Object(assertThisInitialized["a" /* default */])(_this))), {
size: 1
maxSize: 1
});
_this.savedContent = value;
_this.patterns = getPatterns({
@ -14331,14 +14337,14 @@ function (_Component) {
var _this$state = this.state,
start = _this$state.start,
end = _this$state.end,
selectedFormat = _this$state.selectedFormat;
activeFormats = _this$state.activeFormats;
return {
formats: formats,
replacements: replacements,
text: text,
start: start,
end: end,
selectedFormat: selectedFormat
activeFormats: activeFormats
};
}
}, {
@ -14527,6 +14533,7 @@ function (_Component) {
unstableOnFocus();
}
this.recalculateBoundaryStyle();
document.addEventListener('selectionchange', this.onSelectionChange);
}
}, {
@ -14564,46 +14571,19 @@ function (_Component) {
}
}
var selectedFormat = this.state.selectedFormat;
var value = this.createRecord();
var _this$state2 = this.state,
_this$state2$activeFo = _this$state2.activeFormats,
activeFormats = _this$state2$activeFo === void 0 ? [] : _this$state2$activeFo,
start = _this$state2.start; // Update the formats between the last and new caret position.
var _this$createRecord = this.createRecord(),
formats = _this$createRecord.formats,
replacements = _this$createRecord.replacements,
text = _this$createRecord.text,
start = _this$createRecord.start,
end = _this$createRecord.end;
if (this.formatPlaceholder) {
selectedFormat = this.formatPlaceholder.length;
if (selectedFormat > 0) {
formats[this.state.start] = this.formatPlaceholder;
} else {
delete formats[this.state.start];
}
} else if (selectedFormat > 0) {
var formatsBefore = formats[start - 1] || [];
var formatsAfter = formats[start] || [];
var source = formatsBefore;
if (formatsAfter.length > formatsBefore.length) {
source = formatsAfter;
}
source = source.slice(0, selectedFormat);
formats[this.state.start] = source;
} else {
delete formats[this.state.start];
}
var change = {
formats: formats,
replacements: replacements,
text: text,
var change = Object(external_this_wp_richText_["__unstableUpdateFormats"])({
value: value,
start: start,
end: end,
selectedFormat: selectedFormat
};
end: value.start,
formats: activeFormats
});
this.onChange(change, {
withoutHistory: true
});
@ -14614,7 +14594,7 @@ function (_Component) {
if (transformed !== change) {
this.onCreateUndoLevel();
this.onChange(Object(objectSpread["a" /* default */])({}, transformed, {
selectedFormat: selectedFormat
activeFormats: activeFormats
}));
} // Create an undo level when input stops for over a second.
@ -14638,44 +14618,47 @@ function (_Component) {
}, {
key: "onSelectionChange",
value: function onSelectionChange() {
if (this.ignoreSelectionChange) {
delete this.ignoreSelectionChange;
return;
}
var value = this.createRecord();
var start = value.start,
end = value.end,
formats = value.formats;
end = value.end;
if (start !== this.state.start || end !== this.state.end) {
var isCaretWithinFormattedText = this.props.isCaretWithinFormattedText;
if (!isCaretWithinFormattedText && formats[start]) {
var activeFormats = Object(external_this_wp_richText_["__unstableGetActiveFormats"])(value);
if (!isCaretWithinFormattedText && activeFormats.length) {
this.props.onEnterFormattedText();
} else if (isCaretWithinFormattedText && !formats[start]) {
} else if (isCaretWithinFormattedText && !activeFormats.length) {
this.props.onExitFormattedText();
}
var selectedFormat;
if (Object(external_this_wp_richText_["isCollapsed"])(value)) {
var formatsBefore = formats[start - 1] || [];
var formatsAfter = formats[start] || [];
selectedFormat = Math.min(formatsBefore.length, formatsAfter.length);
}
this.setState({
start: start,
end: end,
selectedFormat: selectedFormat
activeFormats: activeFormats
});
this.applyRecord(Object(objectSpread["a" /* default */])({}, value, {
selectedFormat: selectedFormat
activeFormats: activeFormats
}), {
domOnly: true
});
delete this.formatPlaceholder;
if (activeFormats.length > 0) {
this.recalculateBoundaryStyle();
}
}
}
}, {
key: "recalculateBoundaryStyle",
value: function recalculateBoundaryStyle() {
var boundarySelector = '*[data-rich-text-format-boundary]';
var element = this.editableRef.querySelector(boundarySelector);
if (element) {
var computedStyle = getComputedStyle(element);
var newColor = computedStyle.color.replace(')', ', 0.2)').replace('rgb', 'rgba');
globalStyle.innerHTML = "*:focus ".concat(boundarySelector, "{background-color: ").concat(newColor, "}");
}
}
/**
@ -14713,16 +14696,15 @@ function (_Component) {
this.applyRecord(record);
var start = record.start,
end = record.end,
formatPlaceholder = record.formatPlaceholder,
selectedFormat = record.selectedFormat;
this.formatPlaceholder = formatPlaceholder;
_record$activeFormats = record.activeFormats,
activeFormats = _record$activeFormats === void 0 ? [] : _record$activeFormats;
this.onChangeEditableValue(record);
this.savedContent = this.valueToFormat(record);
this.props.onChange(this.savedContent);
this.setState({
start: start,
end: end,
selectedFormat: selectedFormat
activeFormats: activeFormats
});
if (!withoutHistory) {
@ -14939,20 +14921,22 @@ function (_Component) {
}, {
key: "handleHorizontalNavigation",
value: function handleHorizontalNavigation(event) {
var _this2 = this;
var value = this.createRecord();
var formats = value.formats,
text = value.text,
start = value.start,
end = value.end;
var selectedFormat = this.state.selectedFormat;
var _this$state$activeFor = this.state.activeFormats,
activeFormats = _this$state$activeFor === void 0 ? [] : _this$state$activeFor;
var collapsed = Object(external_this_wp_richText_["isCollapsed"])(value);
var isReverse = event.keyCode === external_this_wp_keycodes_["LEFT"];
delete this.formatPlaceholder; // If the selection is collapsed and at the very start, do nothing if
var isReverse = event.keyCode === external_this_wp_keycodes_["LEFT"]; // If the selection is collapsed and at the very start, do nothing if
// navigating backward.
// If the selection is collapsed and at the very end, do nothing if
// navigating forward.
if (collapsed && selectedFormat === 0) {
if (collapsed && activeFormats.length === 0) {
if (start === 0 && isReverse) {
return;
}
@ -14970,39 +14954,48 @@ function (_Component) {
} // In all other cases, prevent default behaviour.
event.preventDefault(); // Ignore the selection change handler when setting selection, all state
// will be set here.
this.ignoreSelectionChange = true;
event.preventDefault();
var formatsBefore = formats[start - 1] || [];
var formatsAfter = formats[start] || [];
var newSelectedFormat = selectedFormat; // If the amount of formats before the caret and after the caret is
var newActiveFormatsLength = activeFormats.length;
var source = formatsAfter;
if (formatsBefore.length > formatsAfter.length) {
source = formatsBefore;
} // If the amount of formats before the caret and after the caret is
// different, the caret is at a format boundary.
if (formatsBefore.length < formatsAfter.length) {
if (!isReverse && selectedFormat < formatsAfter.length) {
newSelectedFormat++;
if (!isReverse && activeFormats.length < formatsAfter.length) {
newActiveFormatsLength++;
}
if (isReverse && selectedFormat > formatsBefore.length) {
newSelectedFormat--;
if (isReverse && activeFormats.length > formatsBefore.length) {
newActiveFormatsLength--;
}
} else if (formatsBefore.length > formatsAfter.length) {
if (!isReverse && selectedFormat > formatsAfter.length) {
newSelectedFormat--;
if (!isReverse && activeFormats.length > formatsAfter.length) {
newActiveFormatsLength--;
}
if (isReverse && selectedFormat < formatsBefore.length) {
newSelectedFormat++;
if (isReverse && activeFormats.length < formatsBefore.length) {
newActiveFormatsLength++;
}
}
} // Wait for boundary class to be added.
if (newSelectedFormat !== selectedFormat) {
setTimeout(function () {
return _this2.recalculateBoundaryStyle();
});
if (newActiveFormatsLength !== activeFormats.length) {
var newActiveFormats = source.slice(0, newActiveFormatsLength);
this.applyRecord(Object(objectSpread["a" /* default */])({}, value, {
selectedFormat: newSelectedFormat
activeFormats: newActiveFormats
}));
this.setState({
selectedFormat: newSelectedFormat
activeFormats: newActiveFormats
});
return;
}
@ -15015,7 +15008,7 @@ function (_Component) {
this.applyRecord(Object(objectSpread["a" /* default */])({}, value, {
start: newPos,
end: newPos,
selectedFormat: isReverse ? formatsBefore.length : formatsAfter.length
activeFormats: isReverse ? formatsBefore : formatsAfter
}));
}
/**
@ -15102,7 +15095,7 @@ function (_Component) {
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
var _this2 = this;
var _this3 = this;
var _this$props2 = this.props,
tagName = _this$props2.tagName,
@ -15140,12 +15133,12 @@ function (_Component) {
} // Allow primitives and arrays:
if (!Object(external_lodash_["isPlainObject"])(_this2.props[name])) {
return _this2.props[name] !== prevProps[name];
if (!Object(external_lodash_["isPlainObject"])(_this3.props[name])) {
return _this3.props[name] !== prevProps[name];
}
return Object.keys(_this2.props[name]).some(function (subName) {
return _this2.props[name][subName] !== prevProps[name][subName];
return Object.keys(_this3.props[name]).some(function (subName) {
return _this3.props[name][subName] !== prevProps[name][subName];
});
});
@ -15272,7 +15265,7 @@ function (_Component) {
}, {
key: "render",
value: function render() {
var _this3 = this;
var _this4 = this;
var _this$props3 = this.props,
_this$props3$tagName = _this$props3.tagName,
@ -15324,7 +15317,7 @@ function (_Component) {
tagName: Tagname,
style: style,
record: record,
valueToEditableHTML: _this3.valueToEditableHTML,
valueToEditableHTML: _this4.valueToEditableHTML,
isPlaceholderVisible: isPlaceholderVisible,
"aria-label": placeholder,
"aria-autocomplete": "list",
@ -15333,21 +15326,21 @@ function (_Component) {
}, ariaProps, {
className: className,
key: key,
onPaste: _this3.onPaste,
onInput: _this3.onInput,
onCompositionEnd: _this3.onCompositionEnd,
onKeyDown: _this3.onKeyDown,
onFocus: _this3.onFocus,
onBlur: _this3.onBlur,
onMouseDown: _this3.onPointerDown,
onTouchStart: _this3.onPointerDown,
setRef: _this3.setRef
onPaste: _this4.onPaste,
onInput: _this4.onInput,
onCompositionEnd: _this4.onCompositionEnd,
onKeyDown: _this4.onKeyDown,
onFocus: _this4.onFocus,
onBlur: _this4.onBlur,
onMouseDown: _this4.onPointerDown,
onTouchStart: _this4.onPointerDown,
setRef: _this4.setRef
})), isPlaceholderVisible && Object(external_this_wp_element_["createElement"])(Tagname, {
className: classnames_default()('editor-rich-text__editable block-editor-rich-text__editable', className),
style: style
}, MultilineTag ? Object(external_this_wp_element_["createElement"])(MultilineTag, null, placeholder) : placeholder), isSelected && Object(external_this_wp_element_["createElement"])(format_edit, {
value: record,
onChange: _this3.onChange
onChange: _this4.onChange
}));
}), isSelected && Object(external_this_wp_element_["createElement"])(RemoveBrowserShortcuts, null));
}
@ -17109,8 +17102,7 @@ function BlockModeToggle(_ref) {
return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], {
className: "editor-block-settings-menu__control block-editor-block-settings-menu__control",
onClick: onToggleMode,
icon: "html",
label: small ? label : undefined
icon: "html"
}, !small && label);
}
/* harmony default export */ var block_mode_toggle = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select, _ref2) {
@ -17329,8 +17321,7 @@ function BlockConvertButton(_ref) {
return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], {
className: "editor-block-settings-menu__control block-editor-block-settings-menu__control",
onClick: onClick,
icon: "screenoptions",
label: small ? label : undefined
icon: "screenoptions"
}, !small && label);
}
@ -17862,10 +17853,6 @@ function BlockToolbar(_ref) {
// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/copy-handler/index.js
/**
* WordPress dependencies
*/
@ -17874,54 +17861,18 @@ function BlockToolbar(_ref) {
function CopyHandler(_ref) {
var children = _ref.children,
onCopy = _ref.onCopy,
onCut = _ref.onCut;
return Object(external_this_wp_element_["createElement"])("div", {
onCopy: onCopy,
onCut: onCut
}, children);
}
var copy_handler_CopyHandler =
/*#__PURE__*/
function (_Component) {
Object(inherits["a" /* default */])(CopyHandler, _Component);
function CopyHandler() {
var _this;
Object(classCallCheck["a" /* default */])(this, CopyHandler);
_this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(CopyHandler).apply(this, arguments));
_this.onCopy = function (event) {
return _this.props.onCopy(event);
};
_this.onCut = function (event) {
return _this.props.onCut(event);
};
return _this;
}
Object(createClass["a" /* default */])(CopyHandler, [{
key: "componentDidMount",
value: function componentDidMount() {
document.addEventListener('copy', this.onCopy);
document.addEventListener('cut', this.onCut);
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
document.removeEventListener('copy', this.onCopy);
document.removeEventListener('cut', this.onCut);
}
}, {
key: "render",
value: function render() {
return null;
}
}]);
return CopyHandler;
}(external_this_wp_element_["Component"]);
/* harmony default export */ var copy_handler = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps, _ref) {
var select = _ref.select;
/* harmony default export */ var copy_handler = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withDispatch"])(function (dispatch, ownProps, _ref2) {
var select = _ref2.select;
var _select = select('core/block-editor'),
getBlocksByClientId = _select.getBlocksByClientId,
@ -17961,7 +17912,7 @@ function (_Component) {
}
}
};
})])(copy_handler_CopyHandler));
})])(CopyHandler));
// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/multi-select-scroll-into-view/index.js

File diff suppressed because one or more lines are too long

View File

@ -2180,7 +2180,7 @@ var findBlock = function findBlock(url) {
return _constants__WEBPACK_IMPORTED_MODULE_5__[/* DEFAULT_EMBED_BLOCK */ "b"];
};
var isFromWordPress = function isFromWordPress(html) {
return Object(lodash__WEBPACK_IMPORTED_MODULE_6__["includes"])(html, 'class="wp-embedded-content" data-secret');
return Object(lodash__WEBPACK_IMPORTED_MODULE_6__["includes"])(html, 'class="wp-embedded-content"');
};
var getPhotoHtml = function getPhotoHtml(photo) {
// 100% width for the preview so it fits nicely into the document, some "thumbnails" are
@ -4115,13 +4115,28 @@ function getEmbedEditComponent(title, icon) {
if (switchedPreview || switchedURL) {
if (this.props.cannotEmbed) {
// Can't embed this URL, and we've just received or switched the preview.
// We either have a new preview or a new URL, but we can't embed it.
if (!this.props.fetching) {
// If we're not fetching the preview, then we know it can't be embedded, so try
// removing any trailing slash, and resubmit.
this.resubmitWithoutTrailingSlash();
}
return;
}
this.handleIncomingPreview();
}
}
}, {
key: "resubmitWithoutTrailingSlash",
value: function resubmitWithoutTrailingSlash() {
this.setState(function (prevState) {
return {
url: prevState.url.replace(/\/$/, '')
};
}, this.setUrl);
}
}, {
key: "setUrl",
value: function setUrl(event) {
@ -8003,11 +8018,15 @@ var settings = {
className = _ref2.className;
var content = attributes.content;
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_3__["RichText"], {
tagName: "pre",
tagName: "pre" // Ensure line breaks are normalised to HTML.
,
value: content.replace(/\n/g, '<br>'),
onChange: function onChange(nextContent) {
setAttributes({
content: nextContent
// Ensure line breaks are normalised to characters. This
// saves space, is easier to read, and ensures display
// filters work correctly.
content: nextContent.replace(/<br ?\/?>/g, '\n')
});
},
placeholder: Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Write preformatted text…'),
@ -19134,106 +19153,6 @@ var settings = {
"use strict";
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: external {"this":["wp","i18n"]}
var external_this_wp_i18n_ = __webpack_require__(1);
// EXTERNAL MODULE: external {"this":["wp","element"]}
var external_this_wp_element_ = __webpack_require__(0);
// EXTERNAL MODULE: external {"this":["wp","blockEditor"]}
var external_this_wp_blockEditor_ = __webpack_require__(8);
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/edit.js
/**
* WordPress dependencies
*/
function SearchEdit(_ref) {
var className = _ref.className,
attributes = _ref.attributes,
setAttributes = _ref.setAttributes;
var label = attributes.label,
placeholder = attributes.placeholder,
buttonText = attributes.buttonText;
return Object(external_this_wp_element_["createElement"])("div", {
className: className
}, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], {
wrapperClassName: "wp-block-search__label",
"aria-label": Object(external_this_wp_i18n_["__"])('Label text'),
placeholder: Object(external_this_wp_i18n_["__"])('Add label…'),
keepPlaceholderOnFocus: true,
formattingControls: [],
value: label,
onChange: function onChange(html) {
return setAttributes({
label: html
});
}
}), Object(external_this_wp_element_["createElement"])("input", {
className: "wp-block-search__input",
"aria-label": Object(external_this_wp_i18n_["__"])('Optional placeholder text') // We hide the placeholder field's placeholder when there is a value. This
// stops screen readers from reading the placeholder field's placeholder
// which is confusing.
,
placeholder: placeholder ? undefined : Object(external_this_wp_i18n_["__"])('Optional placeholder…'),
value: placeholder,
onChange: function onChange(event) {
return setAttributes({
placeholder: event.target.value
});
}
}), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], {
wrapperClassName: "wp-block-search__button",
className: "wp-block-search__button-rich-text",
"aria-label": Object(external_this_wp_i18n_["__"])('Button text'),
placeholder: Object(external_this_wp_i18n_["__"])('Add button text…'),
keepPlaceholderOnFocus: true,
formattingControls: [],
value: buttonText,
onChange: function onChange(html) {
return setAttributes({
buttonText: html
});
}
}));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/index.js
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "name", function() { return search_name; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; });
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
var search_name = 'core/search';
var settings = {
title: Object(external_this_wp_i18n_["__"])('Search'),
description: Object(external_this_wp_i18n_["__"])('Help visitors find your content.'),
icon: 'search',
category: 'widgets',
keywords: [Object(external_this_wp_i18n_["__"])('find')],
edit: SearchEdit,
save: function save() {
return null;
}
};
/***/ }),
/* 251 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
var objectSpread = __webpack_require__(7);
@ -19609,6 +19528,106 @@ var settings = {
};
/***/ }),
/* 251 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: external {"this":["wp","i18n"]}
var external_this_wp_i18n_ = __webpack_require__(1);
// EXTERNAL MODULE: external {"this":["wp","element"]}
var external_this_wp_element_ = __webpack_require__(0);
// EXTERNAL MODULE: external {"this":["wp","blockEditor"]}
var external_this_wp_blockEditor_ = __webpack_require__(8);
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/edit.js
/**
* WordPress dependencies
*/
function SearchEdit(_ref) {
var className = _ref.className,
attributes = _ref.attributes,
setAttributes = _ref.setAttributes;
var label = attributes.label,
placeholder = attributes.placeholder,
buttonText = attributes.buttonText;
return Object(external_this_wp_element_["createElement"])("div", {
className: className
}, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], {
wrapperClassName: "wp-block-search__label",
"aria-label": Object(external_this_wp_i18n_["__"])('Label text'),
placeholder: Object(external_this_wp_i18n_["__"])('Add label…'),
keepPlaceholderOnFocus: true,
formattingControls: [],
value: label,
onChange: function onChange(html) {
return setAttributes({
label: html
});
}
}), Object(external_this_wp_element_["createElement"])("input", {
className: "wp-block-search__input",
"aria-label": Object(external_this_wp_i18n_["__"])('Optional placeholder text') // We hide the placeholder field's placeholder when there is a value. This
// stops screen readers from reading the placeholder field's placeholder
// which is confusing.
,
placeholder: placeholder ? undefined : Object(external_this_wp_i18n_["__"])('Optional placeholder…'),
value: placeholder,
onChange: function onChange(event) {
return setAttributes({
placeholder: event.target.value
});
}
}), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["RichText"], {
wrapperClassName: "wp-block-search__button",
className: "wp-block-search__button-rich-text",
"aria-label": Object(external_this_wp_i18n_["__"])('Button text'),
placeholder: Object(external_this_wp_i18n_["__"])('Add button text…'),
keepPlaceholderOnFocus: true,
formattingControls: [],
value: buttonText,
onChange: function onChange(html) {
return setAttributes({
buttonText: html
});
}
}));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/index.js
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "name", function() { return search_name; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; });
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
var search_name = 'core/search';
var settings = {
title: Object(external_this_wp_i18n_["__"])('Search'),
description: Object(external_this_wp_i18n_["__"])('Help visitors find your content.'),
icon: 'search',
category: 'widgets',
keywords: [Object(external_this_wp_i18n_["__"])('find')],
edit: SearchEdit,
save: function save() {
return null;
}
};
/***/ }),
/* 252 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
@ -20098,10 +20117,10 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _more__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(248);
/* harmony import */ var _nextpage__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(249);
/* harmony import */ var _preformatted__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(213);
/* harmony import */ var _pullquote__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(251);
/* harmony import */ var _pullquote__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(250);
/* harmony import */ var _block__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(233);
/* harmony import */ var _rss__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(252);
/* harmony import */ var _search__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(250);
/* harmony import */ var _search__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(251);
/* harmony import */ var _separator__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(214);
/* harmony import */ var _shortcode__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(215);
/* harmony import */ var _spacer__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(216);

File diff suppressed because one or more lines are too long

View File

@ -10974,10 +10974,15 @@ function pasteHandler(_ref3) {
_ref3$canUserUseUnfil = _ref3.canUserUseUnfilteredHTML,
canUserUseUnfilteredHTML = _ref3$canUserUseUnfil === void 0 ? false : _ref3$canUserUseUnfil;
// First of all, strip any meta tags.
HTML = HTML.replace(/<meta[^>]+>/, ''); // If we detect block delimiters, parse entirely as blocks.
HTML = HTML.replace(/<meta[^>]+>/, ''); // If we detect block delimiters in HTML, parse entirely as blocks.
if (mode !== 'INLINE' && HTML.indexOf('<!-- wp:') !== -1) {
return parseWithGrammar(HTML);
if (mode !== 'INLINE') {
// Check plain text if there is no HTML.
var content = HTML ? HTML : plainText;
if (content.indexOf('<!-- wp:') !== -1) {
return parseWithGrammar(content);
}
} // Normalize unicode to use composed characters.
// This is unsupported in IE 11 but it's a nice-to-have feature, not mandatory.
// Not normalizing the content will only affect older browsers and won't

File diff suppressed because one or more lines are too long

View File

@ -33914,21 +33914,16 @@ function MenuItem(_ref) {
isSelected = _ref.isSelected,
_ref$role = _ref.role,
role = _ref$role === void 0 ? 'menuitem' : _ref$role,
instanceId = _ref.instanceId,
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["children", "info", "className", "icon", "shortcut", "isSelected", "role", "instanceId"]);
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["children", "info", "className", "icon", "shortcut", "isSelected", "role"]);
className = classnames_default()('components-menu-item__button', className, {
'has-icon': icon
});
if (info) {
var infoId = 'edit-post-feature-toggle__info-' + instanceId; // Deconstructed props is scoped to the function; mutation is fine.
props['aria-describedby'] = infoId;
children = Object(external_this_wp_element_["createElement"])("span", {
className: "components-menu-item__info-wrapper"
}, children, Object(external_this_wp_element_["createElement"])("span", {
id: infoId,
className: "components-menu-item__info"
}, info));
}

File diff suppressed because one or more lines are too long

View File

@ -436,16 +436,19 @@ function isSelectionForward(selection) {
return true;
}
/**
* Check whether the selection is horizontally at the edge of the container.
* Check whether the selection is at the edge of the container. Checks for
* horizontal position by default. Set `onlyVertical` to true to check only
* vertically.
*
* @param {Element} container Focusable element.
* @param {boolean} isReverse Set to true to check left, false for right.
* @param {Element} container Focusable element.
* @param {boolean} isReverse Set to true to check left, false to check right.
* @param {boolean} onlyVertical Set to true to check only vertical position.
*
* @return {boolean} True if at the horizontal edge, false if not.
* @return {boolean} True if at the edge, false if not.
*/
function isHorizontalEdge(container, isReverse) {
function isEdge(container, isReverse, onlyVertical) {
if (Object(external_lodash_["includes"])(['INPUT', 'TEXTAREA'], container.tagName)) {
if (container.selectionStart !== container.selectionEnd) {
return false;
@ -462,69 +465,71 @@ function isHorizontalEdge(container, isReverse) {
return true;
}
var selection = window.getSelection(); // Create copy of range for setting selection to find effective offset.
var selection = window.getSelection();
var range = selection.getRangeAt(0).cloneRange(); // Collapse in direction of selection.
if (!selection.isCollapsed) {
range.collapse(!isSelectionForward(selection));
if (!selection.rangeCount) {
return false;
}
var node = range.startContainer;
var extentOffset;
var rangeRect = getRectangleFromRange(selection.getRangeAt(0));
if (isReverse) {
// When in reverse, range node should be first.
extentOffset = 0;
} else if (node.nodeValue) {
// Otherwise, vary by node type. A text node has no children. Its range
// offset reflects its position in nodeValue.
//
// "If the startContainer is a Node of type Text, Comment, or
// CDATASection, then the offset is the number of characters from the
// start of the startContainer to the boundary point of the Range."
//
// See: https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
// See: https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue
extentOffset = node.nodeValue.length;
} else {
// "For other Node types, the startOffset is the number of child nodes
// between the start of the startContainer and the boundary point of
// the Range."
//
// See: https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset
extentOffset = node.childNodes.length;
} // Offset of range should be at expected extent.
var position = isReverse ? 'start' : 'end';
var offset = range["".concat(position, "Offset")];
if (offset !== extentOffset) {
if (!rangeRect) {
return false;
} // If confirmed to be at extent, traverse up through DOM, verifying that
// the node is at first or last child for reverse or forward respectively
// (ignoring empty text nodes). Continue until container is reached.
}
var computedStyle = window.getComputedStyle(container);
var lineHeight = parseInt(computedStyle.lineHeight, 10); // Only consider the multiline selection at the edge if the direction is
// towards the edge.
if (!selection.isCollapsed && rangeRect.height > lineHeight && isSelectionForward(selection) === isReverse) {
return false;
} // Calculate a buffer that is half the line height. In some browsers, the
// selection rectangle may not fill the entire height of the line, so we add
// 3/4 the line height to the selection rectangle to ensure that it is well
// over its line boundary.
var order = isReverse ? 'previous' : 'next';
var buffer = 3 * parseInt(lineHeight, 10) / 4;
var containerRect = container.getBoundingClientRect();
var verticalEdge = isReverse ? containerRect.top > rangeRect.top - buffer : containerRect.bottom < rangeRect.bottom + buffer;
while (node !== container) {
var next = node["".concat(order, "Sibling")]; // Skip over empty text nodes.
if (!verticalEdge) {
return false;
}
while (next && next.nodeType === TEXT_NODE && next.data === '') {
next = next["".concat(order, "Sibling")];
}
if (next) {
return false;
}
node = node.parentNode;
} // If reached, range is assumed to be at edge.
if (onlyVertical) {
return true;
} // To calculate the horizontal position, we insert a test range and see if
// this test range has the same horizontal position. This method proves to
// be better than a DOM-based calculation, because it ignores empty text
// nodes and a trailing line break element. In other words, we need to check
// visual positioning, not DOM positioning.
return true;
var x = isReverse ? containerRect.left + 1 : containerRect.right - 1;
var y = isReverse ? containerRect.top + buffer : containerRect.bottom - buffer;
var testRange = hiddenCaretRangeFromPoint(document, x, y, container);
if (!testRange) {
return false;
}
var side = isReverse ? 'left' : 'right';
var testRect = getRectangleFromRange(testRange);
return Math.round(testRect[side]) === Math.round(rangeRect[side]);
}
/**
* Check whether the selection is horizontally at the edge of the container.
*
* @param {Element} container Focusable element.
* @param {boolean} isReverse Set to true to check left, false for right.
*
* @return {boolean} True if at the horizontal edge, false if not.
*/
function isHorizontalEdge(container, isReverse) {
return isEdge(container, isReverse);
}
/**
* Check whether the selection is vertically at the edge of the container.
@ -532,57 +537,11 @@ function isHorizontalEdge(container, isReverse) {
* @param {Element} container Focusable element.
* @param {boolean} isReverse Set to true to check top, false for bottom.
*
* @return {boolean} True if at the edge, false if not.
* @return {boolean} True if at the vertical edge, false if not.
*/
function isVerticalEdge(container, isReverse) {
if (Object(external_lodash_["includes"])(['INPUT', 'TEXTAREA'], container.tagName)) {
return isHorizontalEdge(container, isReverse);
}
if (!container.isContentEditable) {
return true;
}
var selection = window.getSelection(); // Only consider the selection at the edge if the direction is towards the
// edge.
if (!selection.isCollapsed && isSelectionForward(selection) === isReverse) {
return false;
}
var range = selection.rangeCount ? selection.getRangeAt(0) : null;
if (!range) {
return false;
}
var rangeRect = getRectangleFromRange(range);
if (!rangeRect) {
return false;
}
var editableRect = container.getBoundingClientRect(); // Calculate a buffer that is half the line height. In some browsers, the
// selection rectangle may not fill the entire height of the line, so we add
// half the line height to the selection rectangle to ensure that it is well
// over its line boundary.
var _window$getComputedSt = window.getComputedStyle(container),
lineHeight = _window$getComputedSt.lineHeight;
var buffer = parseInt(lineHeight, 10) / 2; // Too low.
if (isReverse && rangeRect.top - buffer > editableRect.top) {
return false;
} // Too high.
if (!isReverse && rangeRect.bottom + buffer < editableRect.bottom) {
return false;
}
return true;
return isEdge(container, isReverse, true);
}
/**
* Get the rectangle of a given Range.
@ -600,6 +559,17 @@ function getRectangleFromRange(range) {
return range.getBoundingClientRect();
}
var _range = range,
startContainer = _range.startContainer; // Correct invalid "BR" ranges. The cannot contain any children.
if (startContainer.nodeName === 'BR') {
var parentNode = startContainer.parentNode;
var index = Array.from(parentNode.childNodes).indexOf(startContainer);
range = document.createRange();
range.setStart(parentNode, index);
range.setEnd(parentNode, index);
}
var rect = range.getClientRects()[0]; // If the collapsed range starts (and therefore ends) at an element node,
// `getClientRects` can be empty in some browsers. This can be resolved
// by adding a temporary text node with zero-width space to the range.
@ -909,8 +879,8 @@ function getScrollContainer(node) {
if (node.scrollHeight > node.clientHeight) {
// ...except when overflow is defined to be hidden or visible
var _window$getComputedSt2 = window.getComputedStyle(node),
overflowY = _window$getComputedSt2.overflowY;
var _window$getComputedSt = window.getComputedStyle(node),
overflowY = _window$getComputedSt.overflowY;
if (/(auto|scroll)/.test(overflowY)) {
return node;

File diff suppressed because one or more lines are too long

View File

@ -3007,7 +3007,6 @@ function FeatureToggle(_ref) {
isSelected: isActive,
onClick: Object(external_lodash_["flow"])(onToggle, speakMessage),
role: "menuitemcheckbox",
label: label,
info: info
}, label);
}
@ -3534,7 +3533,6 @@ function BlockInspectorButton(_ref) {
className: "editor-block-settings-menu__control block-editor-block-settings-menu__control",
onClick: Object(external_lodash_["flow"])(areAdvancedSettingsOpened ? closeSidebar : openEditorSidebar, speakMessage, onClick),
icon: "admin-generic",
label: small ? label : undefined,
shortcut: keyboard_shortcuts.toggleSidebar
}, !small && label);
}
@ -3614,7 +3612,7 @@ PluginBlockSettingsMenuGroup.Slot = Object(external_this_wp_data_["withSelect"])
function VisualEditor() {
return Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockSelectionClearer"], {
className: "edit-post-visual-editor editor-styles-wrapper"
}, Object(external_this_wp_element_["createElement"])(external_this_wp_editor_["VisualEditorGlobalKeyboardShortcuts"], null), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["CopyHandler"], null), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MultiSelectScrollIntoView"], null), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["WritingFlow"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["ObserveTyping"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_editor_["PostTitle"], null), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockList"], null))), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["_BlockSettingsMenuFirstItem"], null, function (_ref) {
}, Object(external_this_wp_element_["createElement"])(external_this_wp_editor_["VisualEditorGlobalKeyboardShortcuts"], null), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["MultiSelectScrollIntoView"], null), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["WritingFlow"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["ObserveTyping"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["CopyHandler"], null, Object(external_this_wp_element_["createElement"])(external_this_wp_editor_["PostTitle"], null), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["BlockList"], null)))), Object(external_this_wp_element_["createElement"])(external_this_wp_blockEditor_["_BlockSettingsMenuFirstItem"], null, function (_ref) {
var onClose = _ref.onClose;
return Object(external_this_wp_element_["createElement"])(block_inspector_button, {
onClick: onClose
@ -6500,7 +6498,7 @@ var plugin_block_settings_menu_item_PluginBlockSettingsMenuItem = function Plugi
return null;
}
return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["IconButton"], {
return Object(external_this_wp_element_["createElement"])(external_this_wp_components_["MenuItem"], {
className: "editor-block-settings-menu__control",
onClick: Object(external_this_wp_compose_["compose"])(onClick, onClose),
icon: icon || 'admin-plugins',

File diff suppressed because one or more lines are too long

View File

@ -754,17 +754,13 @@ function isFormatEqual(format1, format2) {
// CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/normalise-formats.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/**
* Normalises formats: ensures subsequent equal formats have the same reference.
* Normalises formats: ensures subsequent adjacent equal formats have the same
* reference.
*
* @param {Object} value Value to normalise formats of.
*
@ -772,20 +768,21 @@ function isFormatEqual(format1, format2) {
*/
function normaliseFormats(value) {
var refs = [];
var newFormats = value.formats.map(function (formatsAtIndex) {
return formatsAtIndex.map(function (format) {
var equalRef = Object(external_lodash_["find"])(refs, function (ref) {
return isFormatEqual(ref, format);
var newFormats = value.formats.slice();
newFormats.forEach(function (formatsAtIndex, index) {
var formatsAtPreviousIndex = newFormats[index - 1];
if (formatsAtPreviousIndex) {
var newFormatsAtIndex = formatsAtIndex.slice();
newFormatsAtIndex.forEach(function (format, formatIndex) {
var previousFormat = formatsAtPreviousIndex[formatIndex];
if (isFormatEqual(format, previousFormat)) {
newFormatsAtIndex[formatIndex] = previousFormat;
}
});
if (equalRef) {
return equalRef;
}
refs.push(format);
return format;
});
newFormats[index] = newFormatsAtIndex;
}
});
return Object(objectSpread["a" /* default */])({}, value, {
formats: newFormats
@ -821,7 +818,10 @@ function normaliseFormats(value) {
function applyFormat(value, format) {
var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
var newFormats = value.formats.slice(0); // The selection is collapsed.
var formats = value.formats,
_value$activeFormats = value.activeFormats,
activeFormats = _value$activeFormats === void 0 ? [] : _value$activeFormats;
var newFormats = formats.slice(); // The selection is collapsed.
if (startIndex === endIndex) {
var startFormat = Object(external_lodash_["find"])(newFormats[startIndex], {
@ -844,9 +844,8 @@ function applyFormat(value, format) {
// with the format applied.
} else {
var previousFormat = newFormats[startIndex - 1] || [];
return Object(objectSpread["a" /* default */])({}, value, {
formatPlaceholder: [].concat(Object(toConsumableArray["a" /* default */])(previousFormat), [format])
activeFormats: [].concat(Object(toConsumableArray["a" /* default */])(activeFormats), [format])
});
}
} else {
@ -1483,21 +1482,32 @@ function concat() {
function getActiveFormats(_ref) {
var formats = _ref.formats,
start = _ref.start,
selectedFormat = _ref.selectedFormat;
end = _ref.end,
activeFormats = _ref.activeFormats;
if (start === undefined) {
return [];
}
var formatsBefore = formats[start - 1] || [];
var formatsAfter = formats[start] || [];
var source = formatsAfter;
if (start === end) {
// For a collapsed caret, it is possible to override the active formats.
if (activeFormats) {
return activeFormats;
}
if (formatsBefore.length > formatsAfter.length) {
source = formatsBefore;
var formatsBefore = formats[start - 1] || [];
var formatsAfter = formats[start] || []; // By default, select the lowest amount of formats possible (which means
// the caret is positioned outside the format boundary). The user can
// then use arrow keys to define `activeFormats`.
if (formatsBefore.length < formatsAfter.length) {
return formatsBefore;
}
return formatsAfter;
}
return source.slice(0, selectedFormat);
return formats[start] || [];
}
// CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-active-format.js
@ -1948,7 +1958,9 @@ function registerFormatType(name, settings) {
function removeFormat(value, formatType) {
var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
var newFormats = value.formats.slice(0); // If the selection is collapsed, expand start and end to the edges of the
var formats = value.formats,
activeFormats = value.activeFormats;
var newFormats = formats.slice(); // If the selection is collapsed, expand start and end to the edges of the
// format.
if (startIndex === endIndex) {
@ -1970,7 +1982,7 @@ function removeFormat(value, formatType) {
}
} else {
return Object(objectSpread["a" /* default */])({}, value, {
formatPlaceholder: Object(external_lodash_["reject"])(newFormats[startIndex - 1] || [], {
activeFormats: Object(external_lodash_["reject"])(activeFormats, {
type: formatType
})
});
@ -2432,17 +2444,6 @@ function fromFormat(_ref) {
};
}
function getDeepestActiveFormat(value) {
var activeFormats = getActiveFormats(value);
var selectedFormat = value.selectedFormat;
if (selectedFormat === undefined) {
return activeFormats[activeFormats.length - 1];
}
return activeFormats[selectedFormat - 1];
}
var padding = {
type: 'br',
attributes: {
@ -2474,7 +2475,8 @@ function toTree(_ref2) {
var multilineFormat = {
type: multilineTag
};
var deepestActiveFormat = getDeepestActiveFormat(value);
var activeFormats = getActiveFormats(value);
var deepestActiveFormat = activeFormats[activeFormats.length - 1];
var lastSeparatorFormats;
var lastCharacterFormats;
var lastCharacter; // If we're building a multiline tree, start off with a multiline element.
@ -3437,6 +3439,58 @@ function changeListType(value, newFormat) {
});
}
// CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/update-formats.js
/**
* Internal dependencies
*/
/**
* Efficiently updates all the formats from `start` (including) until `end`
* (excluding) with the active formats. Mutates `value`.
*
* @param {Object} $1 Named paramentes.
* @param {Object} $1.value Value te update.
* @param {number} $1.start Index to update from.
* @param {number} $1.end Index to update until.
* @param {Array} $1.formats Replacement formats.
*
* @return {Object} Mutated value.
*/
function updateFormats(_ref) {
var value = _ref.value,
start = _ref.start,
end = _ref.end,
formats = _ref.formats;
var formatsBefore = value.formats[start - 1] || [];
var formatsAfter = value.formats[end] || []; // First, fix the references. If any format right before or after are
// equal, the replacement format should use the same reference.
value.activeFormats = formats.map(function (format, index) {
if (formatsBefore[index]) {
if (isFormatEqual(format, formatsBefore[index])) {
return formatsBefore[index];
}
} else if (formatsAfter[index]) {
if (isFormatEqual(format, formatsAfter[index])) {
return formatsAfter[index];
}
}
return format;
});
while (--end >= start) {
if (value.activeFormats.length > 0) {
value.formats[end] = value.activeFormats;
} else {
delete value.formats[end];
}
}
return value;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/index.js
/* concated harmony reexport applyFormat */__webpack_require__.d(__webpack_exports__, "applyFormat", function() { return applyFormat; });
/* concated harmony reexport charAt */__webpack_require__.d(__webpack_exports__, "charAt", function() { return charAt; });
@ -3470,6 +3524,8 @@ function changeListType(value, newFormat) {
/* concated harmony reexport indentListItems */__webpack_require__.d(__webpack_exports__, "indentListItems", function() { return indentListItems; });
/* concated harmony reexport outdentListItems */__webpack_require__.d(__webpack_exports__, "outdentListItems", function() { return outdentListItems; });
/* concated harmony reexport changeListType */__webpack_require__.d(__webpack_exports__, "changeListType", function() { return changeListType; });
/* concated harmony reexport __unstableUpdateFormats */__webpack_require__.d(__webpack_exports__, "__unstableUpdateFormats", function() { return updateFormats; });
/* concated harmony reexport __unstableGetActiveFormats */__webpack_require__.d(__webpack_exports__, "__unstableGetActiveFormats", function() { return getActiveFormats; });
/**
* Internal dependencies
*/
@ -3503,6 +3559,8 @@ function changeListType(value, newFormat) {

File diff suppressed because one or more lines are too long

View File

@ -225,39 +225,39 @@ function wp_default_packages_scripts( &$scripts ) {
$packages_versions = array(
'a11y' => '2.2.0',
'annotations' => '1.2.0',
'api-fetch' => '3.1.0',
'annotations' => '1.2.2',
'api-fetch' => '3.1.2',
'autop' => '2.0.0',
'blob' => '2.3.0',
'block-editor' => '1.1.0',
'block-library' => '2.4.0',
'block-editor' => '1.1.2',
'block-library' => '2.4.2',
'block-serialization-default-parser' => '3.1.0',
'blocks' => '6.2.0',
'components' => '7.2.0',
'blocks' => '6.2.2',
'components' => '7.2.2',
'compose' => '3.2.0',
'core-data' => '2.2.0',
'core-data' => '2.2.2',
'data' => '4.4.0',
'date' => '3.2.0',
'deprecated' => '2.2.0',
'dom' => '2.2.0',
'dom' => '2.2.2',
'dom-ready' => '2.2.0',
'edit-post' => '3.3.0',
'editor' => '9.2.0',
'edit-post' => '3.3.2',
'editor' => '9.2.2',
'element' => '2.3.0',
'escape-html' => '1.2.0',
'format-library' => '1.4.0',
'format-library' => '1.4.2',
'hooks' => '2.2.0',
'html-entities' => '2.2.0',
'i18n' => '3.3.0',
'is-shallow-equal' => '1.2.0',
'keycodes' => '2.2.0',
'list-reusable-blocks' => '1.3.0',
'list-reusable-blocks' => '1.3.2',
'notices' => '1.3.0',
'nux' => '3.2.0',
'nux' => '3.2.2',
'plugins' => '2.2.0',
'priority-queue' => '1.1.0',
'redux-routine' => '3.2.0',
'rich-text' => '3.2.0',
'rich-text' => '3.2.2',
'shortcode' => '2.2.0',
'token-list' => '1.2.0',
'url' => '2.5.0',

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.2-beta1-45137';
$wp_version = '5.2-beta1-45138';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.