Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Apr 4, 2023
1 parent 8e95826 commit b7d5a41
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 189 deletions.
4 changes: 2 additions & 2 deletions packages/format-library/src/default-formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { unknown } from './unknown';
import { currentYear } from './current-year';
import { footnote } from './footnote';
import { postDate } from './post-date';
import { time } from './time';
import { currentYear } from './current-year';

export default [
bold,
Expand All @@ -34,5 +34,5 @@ export default [
currentYear,
footnote,
postDate,
time,
currentYear,
];
11 changes: 5 additions & 6 deletions packages/format-library/src/footnote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export const footnote = {
name,
title,
tagName: 'data',
className: null,
attributes: {
note: ( element ) => element.replace( /^\[/, '' ).replace( /\]$/, '' ),
note: ( element ) =>
element.innerHTML.replace( /^\[/, '' ).replace( /\]$/, '' ),
},
render() {
return (
Expand All @@ -27,7 +27,7 @@ export const footnote = {
</sup>
);
},
save( { attributes: { note } } ) {
saveFallback( { attributes: { note } } ) {
return `[${ note }]`;
},
edit( {
Expand All @@ -42,9 +42,8 @@ export const footnote = {
const newValue = insertObject( value, {
type: name,
attributes: {
innerHtml: '',
note: '',
},
tagName: 'data',
} );
newValue.start = newValue.end - 1;
onChange( newValue );
Expand Down Expand Up @@ -98,7 +97,7 @@ function InlineUI( { value, onChange, activeObjectAttributes, contentRef } ) {
type: name,
attributes: {
...activeObjectAttributes,
innerHtml: '[' + newNote + ']',
note: newNote,
},
};

Expand Down
16 changes: 8 additions & 8 deletions packages/format-library/src/post-date/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const postDate = {
name,
title,
tagName: 'data',
className: null,
render: function Render() {
const displayType = 'date';
const format = '';
Expand Down Expand Up @@ -54,20 +53,21 @@ export const postDate = {
function onClick() {
const newValue = insertObject( value, {
type: name,
tagName: 'data',
} );
newValue.start = newValue.end - 1;
onChange( newValue );
onFocus();
}

return (
<RichTextToolbarButton
icon={ formatListNumbered }
title={ title }
onClick={ onClick }
isActive={ isObjectActive }
/>
<>
<RichTextToolbarButton
icon={ formatListNumbered }
title={ title }
onClick={ onClick }
isActive={ isObjectActive }
/>
</>
);
},
};
166 changes: 0 additions & 166 deletions packages/format-library/src/time/index.js

This file was deleted.

7 changes: 0 additions & 7 deletions packages/rich-text/src/register-format-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,11 @@ export function registerFormatType( name, settings ) {
return;
}

<<<<<<< HEAD
if ( settings.tagName !== 'data' ) {
if ( settings.className === null ) {
const formatTypeForBareElement = select(
richTextStore
).getFormatTypeForBareElement( settings.tagName );
=======
if ( settings.className === null && settings.tagName !== 'data' ) {
const formatTypeForBareElement = select(
richTextStore
).getFormatTypeForBareElement( settings.tagName );
>>>>>>> 405bbbda44 (wip)

if (
formatTypeForBareElement &&
Expand Down

0 comments on commit b7d5a41

Please sign in to comment.