froala-audio
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -14,3 +14,3 @@ 'use strict'; | ||
audioAllowedTypes: ['mp3', 'mpeg', 'x-m4a'], | ||
audioEditButtons: ['audioReplace', 'audioRemove', '|', 'audioAlign'], | ||
audioEditButtons: ['audioReplace', 'audioRemove', '|', 'audioAutoplay', 'audioAlign'], | ||
audioInsertButtons: ['audioBack', '|', 'audioByURL', 'audioUpload'], | ||
@@ -366,2 +366,8 @@ audioMove: true, | ||
}, | ||
autoplay: function autoplay() { | ||
if (!currentAudio) return false; | ||
var $player = currentAudio.find('audio'); | ||
var isAuto = $player.prop('autoplay'); | ||
$player.prop({ autoplay: !isAuto }); | ||
}, | ||
align: function align(val) { | ||
@@ -376,2 +382,7 @@ if (!currentAudio) return false; | ||
}, | ||
refreshAutoplayButton: function refreshAutoplayButton($btn) { | ||
if (!currentAudio) return false; | ||
var isAuto = currentAudio.find('audio').prop('autoplay'); | ||
$btn.toggleClass('fr-active', isAuto).attr('aria-pressed', isAuto); | ||
}, | ||
refreshAlignButton: function refreshAlignButton($btn) { | ||
@@ -671,2 +682,14 @@ if (!currentAudio) return false; | ||
$.FE.DefineIcon('audioAutoplay', { NAME: 'play-circle' }); | ||
$.FE.RegisterCommand('audioAutoplay', { | ||
title: 'Autoplay', | ||
toggle: true, | ||
callback: function callback() { | ||
this.audio.autoplay(); | ||
}, | ||
refresh: function refresh($btn) { | ||
this.audio.refreshAutoplayButton($btn); | ||
} | ||
}); | ||
$.FE.DefineIcon('audioReplace', { NAME: 'exchange' }); | ||
@@ -673,0 +696,0 @@ $.FE.RegisterCommand('audioReplace', { |
{ | ||
"name": "froala-audio", | ||
"description": "Plugin for inserting and modifying audio players with Froala WYSIWYG Editor.", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "./froala-audio.js", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/ecoach-lms/froala-audio", |
34384
665