返回介绍

Insert Date/Time plugin

发布于 2019-05-06 06:50:36 字数 4231 浏览 1022 评论 0 收藏 0

The insertdatetime plugin provides a toolbar control and menu item Insert date/time (under the Insert menu) that lets a user easily insert the current date and/or time into the editable area at the cursor insertion point.

Type: String

Example
tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "insertdatetime",
  menubar: "insert",
  toolbar: "insertdatetime"
});

Options

These settings affect the execution of the insertdatetime plugin. Formats for both dates and times can be set in these configuration options.

insertdatetime_dateformat

This option allows you to override the default formatting rule for date formats inserted by the mceInsertDate command. This defaults to %Y-%m-%d and where the different % variables get replaced with various date format options.

Example
tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "insertdatetime",
  menubar: "insert",
  toolbar: "insertdatetime"
  insertdatetime_dateformat: "%Y-%m-%d"
});

insertdatetime_formats

Allows you to specify a list of date/time formats to be used in the date menu or date select box. A complete list of formats is available under date formats below.

Example
tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "insertdatetime",
  menubar: "insert",
  toolbar: "insertdatetime"
  insertdatetime_formats: ["%H:%M:%S", "%Y-%m-%d", "%I:%M:%S %p", "%D"]
});

insertdatetime_timeformat

This option allows you to override the default formatting rule for times inserted by the mceInsertTime command. This defaults to %H:%M:%S and where the different % variables get replaced with various date format options.

Example
tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "insertdatetime",
  menubar: "insert",
  toolbar: "insertdatetime"
  insertdatetime_timeformat: "%H:%M:%S"
});

insertdatetime_element

When this option is enabled HTML5 time elements gets generated when you insert dates/times.

Type: Boolean

Possible Values: true, false

Example
tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "insertdatetime",
  menubar: "insert",
  toolbar: "insertdatetime"
  insertdatetime_element: true
});

dateformats

Replacement variables

NameSummary
%Dmm/dd/yy (same as %m/%d/%y)
%r12-hour clock time hh:mm:ss with AM or PM (same as %I:%M:%S %p)
%yyear as a decimal number without a century (range 00 to 99)
%Yyear as a decimal number including the century
%mmonth as a decimal number (range 01 to 12)
%Bfull localized month name (e.g. “January”)
%babbreviated localized month name (e.g. “Jan”)
%dday of the month as a decimal number (range 01 to 31)
%Afull localized weekday name (e.g. “Monday”)
%aabbreviated localized weekday name (e.g. “Mon”)
%Hhour as a decimal number using a 24-hour clock (range 00 to 23)
%Ihour as a decimal number using a 12-hour clock (range 01 to 12)
%Mminute as a decimal number (range 00-59)
%Ssecond as a decimal number (range 00-59)
%peither “am” or “pm” according to the given time value
%%a literal “%” character

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文