diff --git a/tests/behat/wordcount.feature b/tests/behat/wordcount.feature index 8f33e85..7ebedca 100644 --- a/tests/behat/wordcount.feature +++ b/tests/behat/wordcount.feature @@ -29,7 +29,8 @@ Feature: Atto wordcount button And I click on "HTML" "button" And I set the field "Description" to "

" When I click on "HTML" "button" - Then I should see "Words: 0" + Then I should see "Words:" + And I should see "0" @javascript Scenario: Count words on atto is Words only @@ -48,7 +49,8 @@ Feature: Atto wordcount button

""" When I click on "HTML" "button" - Then I should see "Words: 428" + Then I should see "Words:" + And I should see "428" @javascript Scenario: Count words on atto is Words With Multimedia @@ -99,4 +101,5 @@ Feature: Atto wordcount button And I set the field "Muted" to "1" And I set the field "Loop" to "1" When I click on "Insert media" "button" - Then I should see "Words: 430" + Then I should see "Words:" + And I should see "430" diff --git a/yui/build/moodle-atto_wordcount-button/moodle-atto_wordcount-button-debug.js b/yui/build/moodle-atto_wordcount-button/moodle-atto_wordcount-button-debug.js index 22e1a0c..a9cebcb 100644 --- a/yui/build/moodle-atto_wordcount-button/moodle-atto_wordcount-button-debug.js +++ b/yui/build/moodle-atto_wordcount-button/moodle-atto_wordcount-button-debug.js @@ -52,7 +52,7 @@ Y.namespace('M.atto_wordcount').Button = Y.Base.create('button', Y.M.editor_atto wrapper.appendChild( Y.Node.create('
' + '
' - + M.util.get_string('words', 'atto_wordcount') + ': ' + + + M.util.get_string('words', 'atto_wordcount') + ': ' + '0' + '
')); this._count(host.get('editor')); diff --git a/yui/build/moodle-atto_wordcount-button/moodle-atto_wordcount-button-min.js b/yui/build/moodle-atto_wordcount-button/moodle-atto_wordcount-button-min.js index 06ce8a3..e1dce9e 100644 --- a/yui/build/moodle-atto_wordcount-button/moodle-atto_wordcount-button-min.js +++ b/yui/build/moodle-atto_wordcount-button/moodle-atto_wordcount-button-min.js @@ -1 +1 @@ -YUI.add("moodle-atto_wordcount-button",function(o,t){o.namespace("M.atto_wordcount").Button=o.Base.create("button",o.M.editor_atto.EditorPlugin,[],{block:0,updateRate:200,counterid:null,spacer:/(<\/(?!a>|b>|del>|em>|i>|ins>|s>|small>|strong>|sub>|sup>|u>)\w+>|
| )/g,mediaTags:/(<(audio|video)).*(<\/(audio|video)>)/gm,counter:new RegExp("[\\p{Z}\\p{Cc}—–]+","gu"),initializer:function(){var t=this.get("host"),e=t._wrapper;this.counterid=t.get("elementid")+"-word-count",this.counterid=this.counterid.replace(":","-"),this.counterElement=o.Node.create('0'),e.appendChild(o.Node.create('
'+M.util.get_string("words","atto_wordcount")+': 0
')),this._count(t.get("editor")),this.get("host").on("pluginsloaded",function(){this.get("host").on("atto:selectionchanged",this._count,this)},this)},_count:function(t){var e=this;e.block||(e.block=1,setTimeout(function(){o.one("#"+e.counterid).set("text",e._getCount(t)),setTimeout(function(){e.block=0},e.updateRate)}))},_getCount:function(){var t,e=0,o=this.get("host").getCleanHTML();return o&&(t=(t=(o=(o=(o=o.replace(this.spacer,"$1 ")).replace(/<.[^<>]*?>/g,"")).replace(/ | /gi," ")).split(this.counter,-1)).filter(function(t){return""!=t.trim()}))&&(e=t.length),e}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); \ No newline at end of file +YUI.add("moodle-atto_wordcount-button",function(o,t){o.namespace("M.atto_wordcount").Button=o.Base.create("button",o.M.editor_atto.EditorPlugin,[],{block:0,updateRate:200,counterid:null,spacer:/(<\/(?!a>|b>|del>|em>|i>|ins>|s>|small>|strong>|sub>|sup>|u>)\w+>|
| )/g,mediaTags:/(<(audio|video)).*(<\/(audio|video)>)/gm,counter:new RegExp("[\\p{Z}\\p{Cc}—–]+","gu"),initializer:function(){var t=this.get("host"),e=t._wrapper;this.counterid=t.get("elementid")+"-word-count",this.counterid=this.counterid.replace(":","-"),this.counterElement=o.Node.create('0'),e.appendChild(o.Node.create('
'+M.util.get_string("words","atto_wordcount")+': 0
')),this._count(t.get("editor")),this.get("host").on("pluginsloaded",function(){this.get("host").on("atto:selectionchanged",this._count,this)},this)},_count:function(t){var e=this;e.block||(e.block=1,setTimeout(function(){o.one("#"+e.counterid).set("text",e._getCount(t)),setTimeout(function(){e.block=0},e.updateRate)}))},_getCount:function(){var t,e=0,o=this.get("host").getCleanHTML();return o&&(t=(t=(o=(o=(o=o.replace(this.spacer,"$1 ")).replace(/<.[^<>]*?>/g,"")).replace(/ | /gi," ")).split(this.counter,-1)).filter(function(t){return""!=t.trim()}))&&(e=t.length),e}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); \ No newline at end of file diff --git a/yui/build/moodle-atto_wordcount-button/moodle-atto_wordcount-button.js b/yui/build/moodle-atto_wordcount-button/moodle-atto_wordcount-button.js index 22e1a0c..a9cebcb 100644 --- a/yui/build/moodle-atto_wordcount-button/moodle-atto_wordcount-button.js +++ b/yui/build/moodle-atto_wordcount-button/moodle-atto_wordcount-button.js @@ -52,7 +52,7 @@ Y.namespace('M.atto_wordcount').Button = Y.Base.create('button', Y.M.editor_atto wrapper.appendChild( Y.Node.create('
' + '
' - + M.util.get_string('words', 'atto_wordcount') + ': ' + + + M.util.get_string('words', 'atto_wordcount') + ': ' + '0' + '
')); this._count(host.get('editor')); diff --git a/yui/src/button/js/button.js b/yui/src/button/js/button.js index 4260d8e..e1c7dac 100644 --- a/yui/src/button/js/button.js +++ b/yui/src/button/js/button.js @@ -50,7 +50,7 @@ Y.namespace('M.atto_wordcount').Button = Y.Base.create('button', Y.M.editor_atto wrapper.appendChild( Y.Node.create('
' + '
' - + M.util.get_string('words', 'atto_wordcount') + ': ' + + + M.util.get_string('words', 'atto_wordcount') + ': ' + '0' + '
')); this._count(host.get('editor'));