Skip to content

Commit

Permalink
Fix: remove attributes, styling & shortcuts which are not required
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthaknagoshe2002 committed Dec 10, 2024
1 parent bf9093e commit 34d96a6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
1 change: 0 additions & 1 deletion packages/format-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"@wordpress/icons": "*",
"@wordpress/private-apis": "*",
"@wordpress/rich-text": "*",
"@wordpress/url": "*",
"locutus": "2.0.32"
},
"peerDependencies": {
Expand Down
13 changes: 1 addition & 12 deletions packages/format-library/src/time/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import { gmdate, strtotime } from 'locutus/php/datetime';
*/
import { __ } from '@wordpress/i18n';
import { toggleFormat } from '@wordpress/rich-text';
import {
RichTextToolbarButton,
RichTextShortcut,
} from '@wordpress/block-editor';
import { RichTextToolbarButton } from '@wordpress/block-editor';
import { postDate as icon } from '@wordpress/icons';

const name = 'core/time';
Expand Down Expand Up @@ -61,16 +58,13 @@ export const time = {

// Format the datetime attributes using gmdate
const datetime = gmdate( 'c', timestamp ); // ISO 8601 format
const datetimeISO = gmdate( 'Ymd\\THi', timestamp ); // Compact ISO format

// Apply the format with parsed datetime attributes
onChange(
toggleFormat( value, {
type: name,
attributes: {
datetime,
'data-iso': datetimeISO,
style: 'text-decoration: underline; text-decoration-style: dotted',
},
} )
);
Expand All @@ -80,11 +74,6 @@ export const time = {

return (
<>
<RichTextShortcut
type="access"
character="d"
onUse={ onClick }
/>
<RichTextToolbarButton
icon={ icon }
title={ title }
Expand Down

0 comments on commit 34d96a6

Please sign in to comment.