From 53ba550d59a9a84d70c85204914eec49c57d13c9 Mon Sep 17 00:00:00 2001 From: tianya Date: Wed, 18 Nov 2020 22:10:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=A7=86=E9=A2=91=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E8=AF=AD=E8=A8=80=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ckeditor/plugins/html5video/lang/zh-cn.js | 9 +- .../ckeditor/plugins/html5video/lang/zh.js | 19 ++ .../ckeditor/plugins/html5video/plugin.js | 182 +++++++++--------- 3 files changed, 115 insertions(+), 95 deletions(-) create mode 100644 src/static/ckeditor/plugins/html5video/lang/zh.js diff --git a/src/static/ckeditor/plugins/html5video/lang/zh-cn.js b/src/static/ckeditor/plugins/html5video/lang/zh-cn.js index 3ea9ad4d..1bf38586 100644 --- a/src/static/ckeditor/plugins/html5video/lang/zh-cn.js +++ b/src/static/ckeditor/plugins/html5video/lang/zh-cn.js @@ -1,4 +1,4 @@ -CKEDITOR.plugins.setLang( 'html5video', 'zh-cn', { +CKEDITOR.plugins.setLang('html5video', 'zh-cn', { button: '发布HTML5视频', title: 'HTML5视频', infoLabel: '视频信息', @@ -9,10 +9,11 @@ CKEDITOR.plugins.setLang( 'html5video', 'zh-cn', { btnUpload: '上传', advanced: '高级', autoplay: '自动播放', - allowdownload: 'Allow download?', - advisorytitle: 'Advisory title', + allowdownload: '允许下载?', + advisorytitle: '咨询标题', yes: '是', no: '否', responsive: '自动宽度', + loop: '循环?', controls: '显示控件?' -} ); +}); diff --git a/src/static/ckeditor/plugins/html5video/lang/zh.js b/src/static/ckeditor/plugins/html5video/lang/zh.js new file mode 100644 index 00000000..1bf38586 --- /dev/null +++ b/src/static/ckeditor/plugins/html5video/lang/zh.js @@ -0,0 +1,19 @@ +CKEDITOR.plugins.setLang('html5video', 'zh-cn', { + button: '发布HTML5视频', + title: 'HTML5视频', + infoLabel: '视频信息', + allowed: '支持格式: MP4, WebM, Ogv', + urlMissing: '视频url', + videoProperties: '视频属性', + upload: '上传视频', + btnUpload: '上传', + advanced: '高级', + autoplay: '自动播放', + allowdownload: '允许下载?', + advisorytitle: '咨询标题', + yes: '是', + no: '否', + responsive: '自动宽度', + loop: '循环?', + controls: '显示控件?' +}); diff --git a/src/static/ckeditor/plugins/html5video/plugin.js b/src/static/ckeditor/plugins/html5video/plugin.js index 9a71e49a..4ce4d1d1 100644 --- a/src/static/ckeditor/plugins/html5video/plugin.js +++ b/src/static/ckeditor/plugins/html5video/plugin.js @@ -1,9 +1,9 @@ -CKEDITOR.plugins.add( 'html5video', { +CKEDITOR.plugins.add('html5video', { requires: 'widget', - lang: 'bg,ca,de,en,eu,es,ru,uk,fr,ko,pt,pt-br,pl', + lang: 'bg,ca,de,en,eu,es,ru,uk,fr,ko,pt,pt-br,pl,zh,zh-cn', icons: 'html5video', - init: function( editor ) { - editor.widgets.add( 'html5video', { + init: function (editor) { + editor.widgets.add('html5video', { button: editor.lang.html5video.button, template: '
', /* @@ -13,154 +13,154 @@ CKEDITOR.plugins.add( 'html5video', { */ allowedContent: 'div[data-responsive](!ckeditor-html5-video){text-align,float,margin-left,margin-right}; video[src,poster,controls,autoplay,width, height,loop]{max-width,height};', requiredContent: 'div(ckeditor-html5-video); video[src];', - upcast: function( element ) { - return element.name === 'div' && element.hasClass( 'ckeditor-html5-video' ); + upcast: function (element) { + return element.name === 'div' && element.hasClass('ckeditor-html5-video'); }, dialog: 'html5video', - init: function() { + init: function () { var src = ''; var autoplay = ''; var loop = ''; var controls = ''; - var align = this.element.getStyle( 'text-align' ); + var align = this.element.getStyle('text-align'); var width = ''; var height = ''; var poster = ''; // If there's a child (the video element) - if ( this.element.getChild( 0 ) ) { + if (this.element.getChild(0)) { // get it's attributes. - src = this.element.getChild( 0 ).getAttribute( 'src' ); - width = this.element.getChild( 0 ).getAttribute( 'width' ); - height = this.element.getChild( 0 ).getAttribute( 'height' ); + src = this.element.getChild(0).getAttribute('src'); + width = this.element.getChild(0).getAttribute('width'); + height = this.element.getChild(0).getAttribute('height'); autoplay = this.element.getChild(0).getAttribute('autoplay'); - allowdownload = !this.element.getChild( 0 ).getAttribute( 'controlslist' ); - loop = this.element.getChild( 0 ).getAttribute( 'loop' ); - advisorytitle = this.element.getChild( 0 ).getAttribute( 'title' ); + allowdownload = !this.element.getChild(0).getAttribute('controlslist'); + loop = this.element.getChild(0).getAttribute('loop'); + advisorytitle = this.element.getChild(0).getAttribute('title'); controls = this.element.getChild(0).getAttribute('controls'); - responsive = this.element.getAttribute( 'data-responsive' ); - poster = this.element.getChild( 0 ).getAttribute( 'poster' ); + responsive = this.element.getAttribute('data-responsive'); + poster = this.element.getChild(0).getAttribute('poster'); } - if ( src ) { - this.setData( 'src', src ); + if (src) { + this.setData('src', src); - if ( align ) { - this.setData( 'align', align ); + if (align) { + this.setData('align', align); } else { - this.setData( 'align', 'none' ); + this.setData('align', 'none'); } - if ( width ) { - this.setData( 'width', width ); + if (width) { + this.setData('width', width); } - if ( height ) { - this.setData( 'height', height ); + if (height) { + this.setData('height', height); } - if ( autoplay ) { - this.setData( 'autoplay', 'yes' ); + if (autoplay) { + this.setData('autoplay', 'yes'); } - if ( allowdownload ) { - this.setData( 'allowdownload', 'yes' ); + if (allowdownload) { + this.setData('allowdownload', 'yes'); } - if ( loop ) { - this.setData( 'loop', 'yes' ); + if (loop) { + this.setData('loop', 'yes'); } - - if ( advisorytitle ) { - this.setData( 'advisorytitle', advisorytitle ); + + if (advisorytitle) { + this.setData('advisorytitle', advisorytitle); } - - if ( responsive ) { - this.setData( 'responsive', responsive ); + + if (responsive) { + this.setData('responsive', responsive); } if (controls) { this.setData('controls', controls); } - if ( poster ) { + if (poster) { this.setData('poster', poster); } } }, - data: function() { + data: function () { // If there is an video source - if ( this.data.src ) { + if (this.data.src) { // and there isn't a child (the video element) - if ( !this.element.getChild( 0 ) ) { + if (!this.element.getChild(0)) { // Create a new