Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
TinyMCE - style: insert date time plugin - font / size

Can anyone tell me how, or if, I can style the text inserted by the TinyMCE insertdatetime plugin?

Specifically, I'd like to set the font size to smaller than the rest of the text.

I'm also wondering if doing so might cause a problem for subsequent typed text, because it would continue with the different font size?

This is what I'm using now:

insertdatetime_formats: [ '✏️ (%d/%m/%Y  -  %Hh%M)', '%d/%m/%Y' ],

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

One way to do this is to wrap the date/time string in a <time> element using insertdatetime_element: true, then style that <time> tag with content_style. As you said, this does create a problem where the text will remain smaller if you continue typing (until you hit the Enter key).

As a workaround, you can use noneditable_noneditable_class and extended_valid_elements to add the noneditable class to the <time> tag (if it doesn't need to be editable) and any text typed after that will go back to the default style.

Example fiddle: https://fiddle.tiny.cloud/LShaab/3

tinymce.init({
    selector: "textarea",
    plugins: [
        "insertdatetime noneditable"
    ],
    insertdatetime_formats: ['(%d/%m/%Y  -  %Hh%M)', '%d/%m/%Y'],
    insertdatetime_element: true,
    content_style: "time { font-size:11px; }",
    noneditable_noneditable_class: 'mceNonEditable',
    extended_valid_elements: 'time[class=mceNonEditable]'
});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!