Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use unstable
  • Loading branch information
getdave committed Aug 6, 2025
commit d3cd4ec9c9dc38dc1874ed79660eab90746fa601
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import { useBlockEditingMode } from '../block-editing-mode';
* Higher-Order Component that filters format edit components based on write mode.
*
* @param {Function} WrappedComponent The format edit component to wrap
* @param {Object} formatSettings The format settings including essential flag
* @param {Object} formatSettings The format settings including __unstableEssential flag
* @return {Function} The wrapped component
*/
const withWriteModeFilter = ( WrappedComponent, formatSettings ) => {
// Early return if format is essential - no filtering needed
if ( formatSettings?.essential ) {
// Early return if format is __unstableEssential - no filtering needed
if ( formatSettings?.__unstableEssential ) {
return WrappedComponent;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/format-library/src/bold/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const bold = {
title,
tagName: 'strong',
className: null,
essential: true,
__unstableEssential: true,
edit( { isActive, value, onChange, onFocus } ) {
function onToggle() {
onChange( toggleFormat( value, { type: name, title } ) );
Expand Down
2 changes: 1 addition & 1 deletion packages/format-library/src/code/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const code = {
title,
tagName: 'code',
className: null,
essential: false,

__unstableInputRule( value ) {
const BACKTICK = '`';
const { start, text } = value;
Expand Down
1 change: 1 addition & 0 deletions packages/format-library/src/image/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const image = {
url: 'src',
alt: 'alt',
},

edit: Edit,
};

Expand Down
2 changes: 1 addition & 1 deletion packages/format-library/src/italic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const italic = {
title,
tagName: 'em',
className: null,
essential: true,
__unstableEssential: true,
edit( { isActive, value, onChange, onFocus } ) {
function onToggle() {
onChange( toggleFormat( value, { type: name, title } ) );
Expand Down
1 change: 1 addition & 0 deletions packages/format-library/src/language/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const language = {
name,
tagName: 'bdo',
className: null,

edit: Edit,
title,
};
Expand Down
2 changes: 1 addition & 1 deletion packages/format-library/src/link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export const link = {
target: 'target',
rel: 'rel',
},
essential: true,
__unstableEssential: true,
__unstablePasteRule( value, { html, plainText } ) {
const pastedText = ( html || plainText )
.replace( /<[^>]+>/g, '' )
Expand Down
1 change: 1 addition & 0 deletions packages/format-library/src/non-breaking-space/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const nonBreakingSpace = {
title,
tagName: 'nbsp',
className: null,

edit( { value, onChange } ) {
function addNonBreakingSpace() {
onChange( insert( value, '\u00a0' ) );
Expand Down
2 changes: 1 addition & 1 deletion packages/format-library/src/strikethrough/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const strikethrough = {
title,
tagName: 's',
className: null,
essential: false,

edit( { isActive, value, onChange, onFocus } ) {
function onClick() {
onChange( toggleFormat( value, { type: name, title } ) );
Expand Down
1 change: 1 addition & 0 deletions packages/format-library/src/subscript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const subscript = {
title,
tagName: 'sub',
className: null,

edit( { isActive, value, onChange, onFocus } ) {
function onToggle() {
onChange( toggleFormat( value, { type: name, title } ) );
Expand Down
1 change: 1 addition & 0 deletions packages/format-library/src/superscript/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const superscript = {
title,
tagName: 'sup',
className: null,

edit( { isActive, value, onChange, onFocus } ) {
function onToggle() {
onChange( toggleFormat( value, { type: name, title } ) );
Expand Down
1 change: 1 addition & 0 deletions packages/format-library/src/text-color/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,6 @@ export const textColor = {
style: 'style',
class: 'class',
},

edit: TextColorEdit,
};
2 changes: 1 addition & 1 deletion packages/format-library/src/underline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const underline = {
attributes: {
style: 'style',
},
essential: false,

edit( { value, onChange } ) {
const onToggle = () => {
onChange(
Expand Down
1 change: 1 addition & 0 deletions packages/format-library/src/unknown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const unknown = {
title,
tagName: '*',
className: null,

edit( { isActive, value, onChange, onFocus } ) {
if ( ! isActive && ! selectionContainsUnknownFormats( value ) ) {
return null;
Expand Down
Loading