mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-10 21:00:59 +01:00
Editor: Second round of package updates ahead of RC3.
Props ellatrix, peterwilsoncc, get_dave, mcsf, talldanwp, youknowriad, desrosj. Merges [51426] to the 5.8 branch. Fixes #53397. Built from https://develop.svn.wordpress.org/branches/5.8@51427 git-svn-id: http://core.svn.wordpress.org/branches/5.8@51038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
eba698dba1
commit
82b9b1a3a5
File diff suppressed because one or more lines are too long
@ -2774,6 +2774,14 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
||||
content: attr(aria-label);
|
||||
}
|
||||
|
||||
[data-rich-text-script] {
|
||||
display: inline;
|
||||
}
|
||||
[data-rich-text-script]::before {
|
||||
content: "</>";
|
||||
background: yellow;
|
||||
}
|
||||
|
||||
.block-editor-skip-to-selected-block {
|
||||
position: absolute;
|
||||
top: -9999em;
|
||||
|
File diff suppressed because one or more lines are too long
8
wp-includes/css/dist/block-editor/style.css
vendored
8
wp-includes/css/dist/block-editor/style.css
vendored
@ -2774,6 +2774,14 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
||||
content: attr(aria-label);
|
||||
}
|
||||
|
||||
[data-rich-text-script] {
|
||||
display: inline;
|
||||
}
|
||||
[data-rich-text-script]::before {
|
||||
content: "</>";
|
||||
background: yellow;
|
||||
}
|
||||
|
||||
.block-editor-skip-to-selected-block {
|
||||
position: absolute;
|
||||
top: -9999em;
|
||||
|
File diff suppressed because one or more lines are too long
37
wp-includes/js/dist/block-editor.js
vendored
37
wp-includes/js/dist/block-editor.js
vendored
@ -20174,14 +20174,15 @@ var diff_character = __webpack_require__("iA5R");
|
||||
*/
|
||||
|
||||
|
||||
const BlockView = ({
|
||||
|
||||
function BlockView({
|
||||
title,
|
||||
rawContent,
|
||||
renderedContent,
|
||||
action,
|
||||
actionText,
|
||||
className
|
||||
}) => {
|
||||
}) {
|
||||
return Object(external_wp_element_["createElement"])("div", {
|
||||
className: className
|
||||
}, Object(external_wp_element_["createElement"])("div", {
|
||||
@ -20192,16 +20193,14 @@ const BlockView = ({
|
||||
className: "block-editor-block-compare__html"
|
||||
}, rawContent), Object(external_wp_element_["createElement"])("div", {
|
||||
className: "block-editor-block-compare__preview edit-post-visual-editor"
|
||||
}, renderedContent)), Object(external_wp_element_["createElement"])("div", {
|
||||
}, Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, Object(external_wp_dom_["safeHTML"])(renderedContent)))), Object(external_wp_element_["createElement"])("div", {
|
||||
className: "block-editor-block-compare__action"
|
||||
}, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
|
||||
isSecondary: true,
|
||||
tabIndex: "0",
|
||||
onClick: action
|
||||
}, actionText)));
|
||||
};
|
||||
|
||||
/* harmony default export */ var block_view = (BlockView);
|
||||
}
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/block-compare/index.js
|
||||
|
||||
@ -20252,35 +20251,27 @@ function BlockCompare({
|
||||
const newBlocks = Object(external_lodash_["castArray"])(convertedBlock); // Get converted block details
|
||||
|
||||
const newContent = newBlocks.map(item => Object(external_wp_blocks_["getSaveContent"])(item.name, item.attributes, item.innerBlocks));
|
||||
const renderedContent = newBlocks.map(item => Object(external_wp_blocks_["getSaveElement"])(item.name, item.attributes, item.innerBlocks));
|
||||
return {
|
||||
rawContent: newContent.join(''),
|
||||
renderedContent
|
||||
};
|
||||
return newContent.join('');
|
||||
}
|
||||
|
||||
const original = {
|
||||
rawContent: block.originalContent,
|
||||
renderedContent: Object(external_wp_blocks_["getSaveElement"])(block.name, block.attributes)
|
||||
};
|
||||
const converted = getConvertedContent(convertor(block));
|
||||
const difference = getDifference(original.rawContent, converted.rawContent);
|
||||
const difference = getDifference(block.originalContent, converted);
|
||||
return Object(external_wp_element_["createElement"])("div", {
|
||||
className: "block-editor-block-compare__wrapper"
|
||||
}, Object(external_wp_element_["createElement"])(block_view, {
|
||||
}, Object(external_wp_element_["createElement"])(BlockView, {
|
||||
title: Object(external_wp_i18n_["__"])('Current'),
|
||||
className: "block-editor-block-compare__current",
|
||||
action: onKeep,
|
||||
actionText: Object(external_wp_i18n_["__"])('Convert to HTML'),
|
||||
rawContent: original.rawContent,
|
||||
renderedContent: original.renderedContent
|
||||
}), Object(external_wp_element_["createElement"])(block_view, {
|
||||
rawContent: block.originalContent,
|
||||
renderedContent: block.originalContent
|
||||
}), Object(external_wp_element_["createElement"])(BlockView, {
|
||||
title: Object(external_wp_i18n_["__"])('After Conversion'),
|
||||
className: "block-editor-block-compare__converted",
|
||||
action: onConvert,
|
||||
actionText: convertButtonText,
|
||||
rawContent: difference,
|
||||
renderedContent: converted.renderedContent
|
||||
renderedContent: converted
|
||||
}));
|
||||
}
|
||||
|
||||
@ -28568,6 +28559,7 @@ useBlockProps.save = external_wp_blocks_["__unstableGetBlockProps"];
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
@ -28675,11 +28667,12 @@ function block_BlockListBlock({
|
||||
let block;
|
||||
|
||||
if (!isValid) {
|
||||
const saveContent = Object(external_wp_blocks_["getSaveContent"])(blockType, attributes);
|
||||
block = Object(external_wp_element_["createElement"])(Block, {
|
||||
className: "has-warning"
|
||||
}, Object(external_wp_element_["createElement"])(block_invalid_warning, {
|
||||
clientId: clientId
|
||||
}), Object(external_wp_element_["createElement"])("div", null, Object(external_wp_blocks_["getSaveElement"])(blockType, attributes)));
|
||||
}), Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, Object(external_wp_dom_["safeHTML"])(saveContent)));
|
||||
} else if (mode === 'html') {
|
||||
// Render blockEdit so the inspector controls don't disappear.
|
||||
// See #8969.
|
||||
|
2
wp-includes/js/dist/block-editor.min.js
vendored
2
wp-includes/js/dist/block-editor.min.js
vendored
File diff suppressed because one or more lines are too long
30
wp-includes/js/dist/block-library.js
vendored
30
wp-includes/js/dist/block-library.js
vendored
@ -87,6 +87,13 @@ this["wp"] = this["wp"] || {}; this["wp"]["blockLibrary"] =
|
||||
/************************************************************************/
|
||||
/******/ ({
|
||||
|
||||
/***/ "1CF3":
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
(function() { module.exports = window["wp"]["dom"]; }());
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ "1K8p":
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
@ -9633,6 +9640,7 @@ const buttons_deprecated_deprecated = [{
|
||||
* WordPress dependencies
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
@ -9679,12 +9687,11 @@ const buttons_transforms_transforms = {
|
||||
transform: buttons => // Creates the buttons block
|
||||
Object(external_wp_blocks_["createBlock"])(buttons_transforms_name, {}, // Loop the selected buttons
|
||||
buttons.map(attributes => {
|
||||
// Remove any HTML tags
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = attributes.content;
|
||||
const text = div.innerText || ''; // Get first url
|
||||
const element = Object(external_wp_richText_["__unstableCreateElement"])(document, attributes.content); // Remove any HTML tags
|
||||
|
||||
const link = div.querySelector('a');
|
||||
const text = element.innerText || ''; // Get first url
|
||||
|
||||
const link = element.querySelector('a');
|
||||
const url = link === null || link === void 0 ? void 0 : link.getAttribute('href'); // Create singular button in the buttons block
|
||||
|
||||
return Object(external_wp_blocks_["createBlock"])('core/button', {
|
||||
@ -9694,10 +9701,9 @@ const buttons_transforms_transforms = {
|
||||
})),
|
||||
isMatch: paragraphs => {
|
||||
return paragraphs.every(attributes => {
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = attributes.content;
|
||||
const text = div.innerText || '';
|
||||
const links = div.querySelectorAll('a');
|
||||
const element = Object(external_wp_richText_["__unstableCreateElement"])(document, attributes.content);
|
||||
const text = element.innerText || '';
|
||||
const links = element.querySelectorAll('a');
|
||||
return text.length <= 30 && links.length <= 1;
|
||||
});
|
||||
}
|
||||
@ -19316,6 +19322,9 @@ const list_settings = {
|
||||
save: list_save_save
|
||||
};
|
||||
|
||||
// EXTERNAL MODULE: external ["wp","dom"]
|
||||
var external_wp_dom_ = __webpack_require__("1CF3");
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/missing/edit.js
|
||||
|
||||
|
||||
@ -19329,6 +19338,7 @@ const list_settings = {
|
||||
|
||||
|
||||
|
||||
|
||||
function MissingBlockWarning({
|
||||
attributes,
|
||||
convertToHTML
|
||||
@ -19361,7 +19371,7 @@ function MissingBlockWarning({
|
||||
className: 'has-warning'
|
||||
}), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], {
|
||||
actions: actions
|
||||
}, messageHTML), Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, originalUndelimitedContent));
|
||||
}, messageHTML), Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, Object(external_wp_dom_["safeHTML"])(originalUndelimitedContent)));
|
||||
}
|
||||
|
||||
const MissingEdit = Object(external_wp_data_["withDispatch"])((dispatch, {
|
||||
|
10
wp-includes/js/dist/block-library.min.js
vendored
10
wp-includes/js/dist/block-library.min.js
vendored
File diff suppressed because one or more lines are too long
46
wp-includes/js/dist/dom.js
vendored
46
wp-includes/js/dist/dom.js
vendored
@ -120,6 +120,7 @@ __webpack_require__.d(__webpack_exports__, "__unstableStripHTML", function() { r
|
||||
__webpack_require__.d(__webpack_exports__, "isEmpty", function() { return /* reexport */ isEmpty; });
|
||||
__webpack_require__.d(__webpack_exports__, "removeInvalidHTML", function() { return /* reexport */ removeInvalidHTML; });
|
||||
__webpack_require__.d(__webpack_exports__, "isRTL", function() { return /* reexport */ isRTL; });
|
||||
__webpack_require__.d(__webpack_exports__, "safeHTML", function() { return /* reexport */ safeHTML; });
|
||||
__webpack_require__.d(__webpack_exports__, "getPhrasingContentSchema", function() { return /* reexport */ getPhrasingContentSchema; });
|
||||
__webpack_require__.d(__webpack_exports__, "isPhrasingContent", function() { return /* reexport */ isPhrasingContent; });
|
||||
__webpack_require__.d(__webpack_exports__, "isTextContent", function() { return /* reexport */ isTextContent; });
|
||||
@ -1953,6 +1954,50 @@ function removeInvalidHTML(HTML, schema, inline) {
|
||||
return doc.body.innerHTML;
|
||||
}
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/safe-html.js
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
/**
|
||||
* Strips scripts and on* attributes from HTML.
|
||||
*
|
||||
* @param {string} html HTML to sanitize.
|
||||
*
|
||||
* @return {string} The sanitized HTML.
|
||||
*/
|
||||
|
||||
function safeHTML(html) {
|
||||
const {
|
||||
body
|
||||
} = document.implementation.createHTMLDocument('');
|
||||
body.innerHTML = html;
|
||||
const elements = body.getElementsByTagName('*');
|
||||
let elementIndex = elements.length;
|
||||
|
||||
while (elementIndex--) {
|
||||
const element = elements[elementIndex];
|
||||
|
||||
if (element.tagName === 'SCRIPT') {
|
||||
remove(element);
|
||||
} else {
|
||||
let attributeIndex = element.attributes.length;
|
||||
|
||||
while (attributeIndex--) {
|
||||
const {
|
||||
name: key
|
||||
} = element.attributes[attributeIndex];
|
||||
|
||||
if (key.startsWith('on')) {
|
||||
element.removeAttribute(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return body.innerHTML;
|
||||
}
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/dom/index.js
|
||||
|
||||
|
||||
@ -1977,6 +2022,7 @@ function removeInvalidHTML(HTML, schema, inline) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// CONCATENATED MODULE: ./node_modules/@wordpress/dom/build-module/data-transfer.js
|
||||
|
2
wp-includes/js/dist/dom.min.js
vendored
2
wp-includes/js/dist/dom.min.js
vendored
File diff suppressed because one or more lines are too long
74
wp-includes/js/dist/rich-text.js
vendored
74
wp-includes/js/dist/rich-text.js
vendored
@ -1274,6 +1274,22 @@ function createFromElement({
|
||||
continue;
|
||||
}
|
||||
|
||||
if (type === 'script') {
|
||||
const value = {
|
||||
formats: [,],
|
||||
replacements: [{
|
||||
type,
|
||||
attributes: {
|
||||
'data-rich-text-script': node.getAttribute('data-rich-text-script') || encodeURIComponent(node.innerHTML)
|
||||
}
|
||||
}],
|
||||
text: OBJECT_REPLACEMENT_CHARACTER
|
||||
};
|
||||
accumulateSelection(accumulator, node, range, value);
|
||||
mergePair(accumulator, value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (type === 'br') {
|
||||
accumulateSelection(accumulator, node, range, createEmptyValue());
|
||||
mergePair(accumulator, create({
|
||||
@ -1452,8 +1468,9 @@ function getAttributes({
|
||||
continue;
|
||||
}
|
||||
|
||||
const safeName = /^on/i.test(name) ? 'data-disable-rich-text-' + name : name;
|
||||
accumulator = accumulator || {};
|
||||
accumulator[name] = value;
|
||||
accumulator[safeName] = value;
|
||||
}
|
||||
|
||||
return accumulator;
|
||||
@ -2437,6 +2454,26 @@ function get_format_type_getFormatType(name) {
|
||||
|
||||
|
||||
|
||||
|
||||
function restoreOnAttributes(attributes, isEditableTree) {
|
||||
if (isEditableTree) {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
const newAttributes = {};
|
||||
|
||||
for (const key in attributes) {
|
||||
let newKey = key;
|
||||
|
||||
if (key.startsWith('data-disable-rich-text-')) {
|
||||
newKey = key.slice('data-disable-rich-text-'.length);
|
||||
}
|
||||
|
||||
newAttributes[newKey] = attributes[key];
|
||||
}
|
||||
|
||||
return newAttributes;
|
||||
}
|
||||
/**
|
||||
* Converts a format object to information that can be used to create an element
|
||||
* from (type, attributes and object).
|
||||
@ -2450,16 +2487,20 @@ function get_format_type_getFormatType(name) {
|
||||
* format.
|
||||
* @param {boolean} $1.boundaryClass Whether or not to apply a boundary
|
||||
* class.
|
||||
* @param {boolean} $1.isEditableTree
|
||||
*
|
||||
* @return {Object} Information to be used for
|
||||
* element creation.
|
||||
*/
|
||||
|
||||
|
||||
function fromFormat({
|
||||
type,
|
||||
attributes,
|
||||
unregisteredAttributes,
|
||||
object,
|
||||
boundaryClass
|
||||
boundaryClass,
|
||||
isEditableTree
|
||||
}) {
|
||||
const formatType = get_format_type_getFormatType(type);
|
||||
let elementAttributes = {};
|
||||
@ -2477,7 +2518,7 @@ function fromFormat({
|
||||
|
||||
return {
|
||||
type,
|
||||
attributes: elementAttributes,
|
||||
attributes: restoreOnAttributes(elementAttributes, isEditableTree),
|
||||
object
|
||||
};
|
||||
}
|
||||
@ -2507,7 +2548,7 @@ function fromFormat({
|
||||
return {
|
||||
type: formatType.tagName,
|
||||
object: formatType.object,
|
||||
attributes: elementAttributes
|
||||
attributes: restoreOnAttributes(elementAttributes, isEditableTree)
|
||||
};
|
||||
}
|
||||
/**
|
||||
@ -2642,7 +2683,8 @@ function toTree({
|
||||
type,
|
||||
attributes,
|
||||
unregisteredAttributes,
|
||||
boundaryClass
|
||||
boundaryClass,
|
||||
isEditableTree
|
||||
}));
|
||||
|
||||
if (isText(pointer) && getText(pointer).length === 0) {
|
||||
@ -2672,9 +2714,21 @@ function toTree({
|
||||
}
|
||||
|
||||
if (character === OBJECT_REPLACEMENT_CHARACTER) {
|
||||
pointer = append(getParent(pointer), fromFormat({ ...replacements[i],
|
||||
object: true
|
||||
})); // Ensure pointer is text node.
|
||||
if (!isEditableTree && replacements[i].type === 'script') {
|
||||
pointer = append(getParent(pointer), fromFormat({
|
||||
type: 'script',
|
||||
isEditableTree
|
||||
}));
|
||||
append(pointer, {
|
||||
html: decodeURIComponent(replacements[i].attributes['data-rich-text-script'])
|
||||
});
|
||||
} else {
|
||||
pointer = append(getParent(pointer), fromFormat({ ...replacements[i],
|
||||
object: true,
|
||||
isEditableTree
|
||||
}));
|
||||
} // Ensure pointer is text node.
|
||||
|
||||
|
||||
pointer = append(getParent(pointer), '');
|
||||
} else if (!preserveWhiteSpace && character === '\n') {
|
||||
@ -3189,6 +3243,10 @@ function createElementHTML({
|
||||
|
||||
function createChildrenHTML(children = []) {
|
||||
return children.map(child => {
|
||||
if (child.html !== undefined) {
|
||||
return child.html;
|
||||
}
|
||||
|
||||
return child.text === undefined ? createElementHTML(child) : Object(external_wp_escapeHtml_["escapeEditableHTML"])(child.text);
|
||||
}).join('');
|
||||
}
|
||||
|
2
wp-includes/js/dist/rich-text.min.js
vendored
2
wp-includes/js/dist/rich-text.min.js
vendored
File diff suppressed because one or more lines are too long
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.8-RC2-51424';
|
||||
$wp_version = '5.8-RC2-51427';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user