X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2Fpackagist%2Fludivine-ckeditor-component.git;a=blobdiff_plain;f=sources%2Fplugins%2Fhtml5audio%2Fplugin.js;fp=sources%2Fplugins%2Fhtml5audio%2Fplugin.js;h=7d0d8868c181caa238c6753a5767e68d0f7e31c3;hp=86bcfbd32e5494754ef9f23a7cbb90fbfb07a173;hb=1794320dcfdfcd19572fb1676294f9853a6bbc20;hpb=7183f6a6a21ad9124e70c997e0168459f377a9f2 diff --git a/sources/plugins/html5audio/plugin.js b/sources/plugins/html5audio/plugin.js index 86bcfbd..7d0d886 100644 --- a/sources/plugins/html5audio/plugin.js +++ b/sources/plugins/html5audio/plugin.js @@ -1,6 +1,6 @@ CKEDITOR.plugins.add( 'html5audio', { requires: 'widget', - lang: 'de,en,eu,es,fr,ru,uk,uz', + lang: 'de,el,en,eu,es,fr,ru,uk,uz,zh-cn', icons: 'html5audio', init: function( editor ) { editor.widgets.add( 'html5audio', { @@ -13,7 +13,7 @@ * - 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,autoplay];', + 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' ); @@ -29,6 +29,7 @@ // get it's attributes. src = this.element.getChild( 0 ).getAttribute( 'src' ); autoplay = this.element.getChild( 0 ).getAttribute( 'autoplay' ); + allowdownload = !this.element.getChild( 0 ).getAttribute( 'controlslist' ); } if ( src ) { @@ -43,6 +44,10 @@ if ( autoplay ) { this.setData( 'autoplay', 'yes' ); } + + if ( allowdownload ) { + this.setData( 'allowdownload', 'yes' ); + } } }, data: function() { @@ -84,6 +89,11 @@ } else { this.element.getChild( 0 ).removeAttribute( 'autoplay' ); } + if ( this.data.allowdownload === 'yes' ) { + this.element.getChild( 0 ).removeAttribute( 'controlslist' ); + } else { + this.element.getChild( 0 ).setAttribute( 'controlslist', 'nodownload' ); + } } } } );