From d78da4c1d00e60f9331e2c202575430d7be940ad Mon Sep 17 00:00:00 2001 From: tianya Date: Wed, 24 May 2023 21:35:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=9F=B3=E9=A2=91=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/html5audio/dialogs/html5audio.js | 152 ++++++++++++++++++ .../html5audio/icons/hidpi/html5audio.png | Bin 0 -> 333 bytes .../plugins/html5audio/icons/html5audio.png | Bin 0 -> 245 bytes .../ckeditor/plugins/html5audio/lang/en.js | 15 ++ .../ckeditor/plugins/html5audio/lang/zh-cn.js | 15 ++ .../ckeditor/plugins/html5audio/plugin.js | 139 ++++++++++++++++ .../ckeditor/plugins/html5video/lang/bg.js | 20 --- .../ckeditor/plugins/html5video/lang/ca.js | 20 --- .../ckeditor/plugins/html5video/lang/de.js | 17 -- .../ckeditor/plugins/html5video/lang/es.js | 18 --- .../ckeditor/plugins/html5video/lang/eu.js | 17 -- .../ckeditor/plugins/html5video/lang/fa.js | 18 --- .../ckeditor/plugins/html5video/lang/fr.js | 17 -- .../ckeditor/plugins/html5video/lang/he.js | 18 --- .../ckeditor/plugins/html5video/lang/ko.js | 20 --- .../ckeditor/plugins/html5video/lang/pl.js | 18 --- .../ckeditor/plugins/html5video/lang/pt-br.js | 18 --- .../ckeditor/plugins/html5video/lang/pt.js | 18 --- .../ckeditor/plugins/html5video/lang/ru.js | 21 --- .../ckeditor/plugins/html5video/lang/uk.js | 17 -- .../ckeditor/plugins/html5video/lang/uz.js | 17 -- src/system/inc/inc_fun_funAdmin.php | 4 +- 22 files changed, 323 insertions(+), 276 deletions(-) create mode 100755 src/static/ckeditor/plugins/html5audio/dialogs/html5audio.js create mode 100644 src/static/ckeditor/plugins/html5audio/icons/hidpi/html5audio.png create mode 100644 src/static/ckeditor/plugins/html5audio/icons/html5audio.png create mode 100755 src/static/ckeditor/plugins/html5audio/lang/en.js create mode 100644 src/static/ckeditor/plugins/html5audio/lang/zh-cn.js create mode 100755 src/static/ckeditor/plugins/html5audio/plugin.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/bg.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/ca.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/de.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/es.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/eu.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/fa.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/fr.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/he.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/ko.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/pl.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/pt-br.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/pt.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/ru.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/uk.js delete mode 100644 src/static/ckeditor/plugins/html5video/lang/uz.js diff --git a/src/static/ckeditor/plugins/html5audio/dialogs/html5audio.js b/src/static/ckeditor/plugins/html5audio/dialogs/html5audio.js new file mode 100755 index 00000000..fc3d8ecc --- /dev/null +++ b/src/static/ckeditor/plugins/html5audio/dialogs/html5audio.js @@ -0,0 +1,152 @@ +CKEDITOR.dialog.add( 'html5audio', function( editor ) { + return { + title: editor.lang.html5audio.title, + minWidth: 500, + minHeight: 100, + contents: [ { + id: 'info', + label: editor.lang.html5audio.infoLabel, + elements: [ { + type: 'vbox', + padding: 0, + children: [ { + type: 'hbox', + widths: [ '365px', '110px' ], + align: 'right', + children: [ { + type: 'text', + id: 'url', + label: editor.lang.common.url, + required: true, + validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.html5audio.urlMissing ), + setup: function( widget ) { + this.setValue( widget.data.src ); + }, + commit: function( widget ) { + widget.setData( 'src', this.getValue() ); + } + }, + { + type: 'button', + id: 'browse', + // v-align with the 'txtUrl' field. + // TODO: We need something better than a fixed size here. + style: 'display:inline-block;margin-top:14px;', + align: 'center', + label: editor.lang.common.browseServer, + hidden: true, + filebrowser: 'info:url' + } ] + } ] + }, + { + type: 'hbox', + id: 'alignment', + children: [ { + type: 'radio', + id: 'align', + label: editor.lang.common.align, + items: [ + [editor.lang.common.alignCenter, 'center'], + [editor.lang.common.alignLeft, 'left'], + [editor.lang.common.alignRight, 'right'], + [editor.lang.common.alignNone, 'none'] + ], + 'default': 'center', + setup: function( widget ) { + if ( widget.data.align ) { + this.setValue( widget.data.align ); + } + }, + commit: function( widget ) { + widget.setData( 'align', this.getValue() ); + } + } ] + } ] + }, + { + id: 'Upload', + hidden: true, + filebrowser: 'uploadButton', + label: editor.lang.html5audio.upload, + elements: [ { + type: 'file', + id: 'upload', + label: editor.lang.html5audio.btnUpload, + style: 'height:40px', + size: 38 + }, + { + type: 'fileButton', + id: 'uploadButton', + filebrowser: 'info:url', + label: editor.lang.html5audio.btnUpload, + 'for': [ 'Upload', 'upload' ] + } ] + }, + { + id: 'advanced', + label: editor.lang.html5audio.advanced, + elements: [ { + type: 'vbox', + padding: 10, + children: [ { + type: 'hbox', + children: [ { + type: 'radio', + id: 'autoplay', + label: editor.lang.html5audio.autoplay, + items: [ + [editor.lang.html5audio.yes, 'yes'], + [editor.lang.html5audio.no, 'no'] + ], + 'default': 'no', + setup: function( widget ) { + if ( widget.data.autoplay ) { + this.setValue( widget.data.autoplay ); + } + }, + commit: function( widget ) { + widget.setData( 'autoplay', this.getValue() ); + } + }, + { + type: 'radio', + id: 'allowdownload', + label: editor.lang.html5audio.allowdownload, + items: [ + [editor.lang.html5audio.yes, 'yes'], + [editor.lang.html5audio.no, 'no'] + ], + 'default': 'no', + setup: function( widget ) { + if ( widget.data.allowdownload ) { + this.setValue(widget.data.allowdownload); + } + }, + commit: function( widget ) { + widget.setData( 'allowdownload', this.getValue() ); + } + } ] + }, + { + type: 'hbox', + children: [ { + type: "text", + id: 'advisorytitle', + label: editor.lang.html5audio.advisorytitle, + 'default': '', + setup: function( widget ) { + if ( widget.data.advisorytitle ) { + this.setValue(widget.data.advisorytitle); + } + }, + commit: function( widget ) { + widget.setData( 'advisorytitle', this.getValue() ); + } + } ] + } ] + } ] + } ] + }; +} ); diff --git a/src/static/ckeditor/plugins/html5audio/icons/hidpi/html5audio.png b/src/static/ckeditor/plugins/html5audio/icons/hidpi/html5audio.png new file mode 100644 index 0000000000000000000000000000000000000000..16f07e722db539f987395a036b5eaffab3fd8b6d GIT binary patch literal 333 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvmUKs7M+SzC{oH>NS%G}U;vjb? zhIQv;UIIA=0X`wF?gc)sU|?@=@8aSDWCBSyH#Z=|-Q67`g6v9 z@(X5YFc4UD;6gxx!h;D89}0w~KimzJTHxv87@~1LIbng+ieK{^4yFJ4|DSn6R~z>R zN0xuq2UwmcGVPKVv}#}yW0m=@exQ_r^;vyl2m7nUKm3gH4LXc}&-3tnD`0HRij7VqUxgdfmuSjc)f;3}I*b|T;5 z0xOOJ#cDp5iUUm7INlq-X=j;Wr_&&D=0dZ8)QRu{cji&XcR*#6iXs5E74`!6q1#=#)@=D)qp zq`-uPfB*mgXMc9DpXZOmG56M>P=m*ZL!PUz;MpJ&V;J$1joU R{{%Ue!PC{xWt~$(69B?hP}=|i literal 0 HcmV?d00001 diff --git a/src/static/ckeditor/plugins/html5audio/lang/en.js b/src/static/ckeditor/plugins/html5audio/lang/en.js new file mode 100755 index 00000000..fd3bb4f0 --- /dev/null +++ b/src/static/ckeditor/plugins/html5audio/lang/en.js @@ -0,0 +1,15 @@ +CKEDITOR.plugins.setLang( 'html5audio', 'en', { + button: 'Insert HTML5 audio', + title: 'HTML5 audio', + infoLabel: 'Audio info', + urlMissing: 'Audio source URL is missing.', + audioProperties: 'Audio properties', + upload: 'Upload', + btnUpload: 'Send it to the server', + advanced: 'Advanced', + autoplay: 'Autoplay?', + allowdownload: 'Allow download?', + advisorytitle: 'Advisory title', + yes: 'Yes', + no: 'No' +} ); diff --git a/src/static/ckeditor/plugins/html5audio/lang/zh-cn.js b/src/static/ckeditor/plugins/html5audio/lang/zh-cn.js new file mode 100644 index 00000000..a64ac1c3 --- /dev/null +++ b/src/static/ckeditor/plugins/html5audio/lang/zh-cn.js @@ -0,0 +1,15 @@ +CKEDITOR.plugins.setLang( 'html5audio', 'zh-cn', { + button: '插入HTML5音频', + title: 'HTML5 音频', + infoLabel: '音频信息', + urlMissing: '音频URL', + audioProperties: '音频属性', + upload: '上传', + btnUpload: '上传到服务器', + advanced: '高级', + autoplay: '自动播放?', + allowdownload: '允许下载?', + advisorytitle: '提示语', + yes: '是', + no: '否' +} ); diff --git a/src/static/ckeditor/plugins/html5audio/plugin.js b/src/static/ckeditor/plugins/html5audio/plugin.js new file mode 100755 index 00000000..5e8cf0d4 --- /dev/null +++ b/src/static/ckeditor/plugins/html5audio/plugin.js @@ -0,0 +1,139 @@ +CKEDITOR.plugins.add( 'html5audio', { + requires: 'widget', + lang: 'bg,ca,de,de-ch,el,en,eu,es,fr,ru,uk,uz,zh-cn,fa,pl', + icons: 'html5audio', + hidpi: true, + init: function( editor ) { + editor.widgets.add( 'html5audio', { + button: editor.lang.html5audio.button, + template: '
', // We add the audio element when needed in the data function, to avoid having an undefined src attribute. + // See issue #9 on github: https://github.com/iametza/ckeditor-html5-audio/issues/9 + editables: {}, + /* + * Allowed content rules (http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules): + * - div-s with text-align,float,margin-left,margin-right inline style rules and required ckeditor-html5-audio class. + * - audio tags with src and controls attributes. + */ + allowedContent: 'div(!ckeditor-html5-audio){text-align,float,margin-left,margin-right}; audio[src,controls,controlslist,autoplay];', + requiredContent: 'div(ckeditor-html5-audio); audio[src,controls];', + upcast: function( element ) { + return element.name === 'div' && element.hasClass( 'ckeditor-html5-audio' ); + }, + dialog: 'html5audio', + init: function() { + var audioElement = this.element.findOne( 'audio' ); + var src = ''; + var autoplay = ''; + var align = this.element.getStyle( 'text-align' ); + var allowdownload = false; + var advisorytitle = ''; + + // If there's a child (the audio element) + if ( audioElement ) { + // get it's attributes. + src = audioElement.getAttribute( 'src' ); + autoplay = audioElement.getAttribute( 'autoplay' ); + allowdownload = !audioElement.getAttribute( 'controlslist' ); + advisorytitle = audioElement.getAttribute( 'title' ); + } + + if ( src ) { + this.setData( 'src', src ); + + if ( align ) { + this.setData( 'align', align ); + } else { + this.setData( 'align', 'none' ); + } + + if ( autoplay ) { + this.setData( 'autoplay', 'yes' ); + } + + if ( allowdownload ) { + this.setData( 'allowdownload', 'yes' ); + } + + if ( advisorytitle ) { + this.setData( 'advisorytitle', advisorytitle ); + } + } + }, + data: function() { + var audioElement = this.element.findOne( 'audio' ); + // If there is an audio source + if ( this.data.src ) { + // and there isn't a child (the audio element) + if ( !audioElement ) { + // Create a new