diff --git a/CHANGES.md b/CHANGES.md index 47a22edc72a..083937b3776 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -16,6 +16,7 @@ Fixed Issues: * [#719](https://github.com/ckeditor/ckeditor-dev/issues/719): Fixed: Image inserted using [Enhanced Image](https://ckeditor.com/addon/image2) plugin could be resized when editor is in read-only mode. * [#577](https://github.com/ckeditor/ckeditor-dev/issues/577): Fixed: "Delete Columns" command provided by [Table Tools](https://ckeditor.com/addon/tabletools) plugin throws an error while trying to delete columns. * [#867](https://github.com/ckeditor/ckeditor-dev/issues/867): Fixed: Typing into selected table throws an error. +* [#817](https://github.com/ckeditor/ckeditor-dev/issues/817): Fixed: [Save](https://ckeditor.com/addon/save) plugin does not work in [Source Mode](https://ckeditor.com/addon/sourcearea). Other Changes: diff --git a/plugins/save/plugin.js b/plugins/save/plugin.js index 7227e2bd389..843c9d716da 100644 --- a/plugins/save/plugin.js +++ b/plugins/save/plugin.js @@ -10,6 +10,7 @@ ( function() { var saveCmd = { readOnly: 1, + modes: { wysiwyg: 1,source: 1 }, exec: function( editor ) { if ( editor.fire( 'save' ) ) { @@ -45,7 +46,7 @@ return; var command = editor.addCommand( pluginName, saveCmd ); - command.modes = { wysiwyg: !!( editor.element.$.form ) }; + command.startDisabled = !( editor.element.$.form ); editor.ui.addButton && editor.ui.addButton( 'Save', { label: editor.lang.save.toolbar, diff --git a/tests/plugins/save/manual/sourcemode.html b/tests/plugins/save/manual/sourcemode.html new file mode 100644 index 00000000000..bd990488a5e --- /dev/null +++ b/tests/plugins/save/manual/sourcemode.html @@ -0,0 +1,9 @@ +
+ +
+ + diff --git a/tests/plugins/save/manual/sourcemode.md b/tests/plugins/save/manual/sourcemode.md new file mode 100644 index 00000000000..d5b2dc062c1 --- /dev/null +++ b/tests/plugins/save/manual/sourcemode.md @@ -0,0 +1,13 @@ +@bender-ui: collapsed +@bender-tags: 817, 4.7.3, bug +@bender-ckeditor-plugins: wysiwygarea, save, sourcearea, toolbar + +**Procedure:** + +1. Check if "Save" button is enabled. +2. Switch to WYSIWYG mode. +3. Check if "Save" button is enabled. + +**Expected result:** + +* "Save" button should be enabled in both modes. diff --git a/tests/plugins/save/save.html b/tests/plugins/save/save.html index 4201fd7815c..ca58bf7578c 100644 --- a/tests/plugins/save/save.html +++ b/tests/plugins/save/save.html @@ -1,3 +1,7 @@ -
- + + +
+ +
+
\ No newline at end of file diff --git a/tests/plugins/save/save.js b/tests/plugins/save/save.js index 168e10c35b5..adc42bedb62 100644 --- a/tests/plugins/save/save.js +++ b/tests/plugins/save/save.js @@ -1,26 +1,35 @@ /* bender-tags: editor */ -/* bender-ckeditor-plugins: toolbar,save,wysiwygarea */ +/* bender-ckeditor-plugins: toolbar,save,wysiwygarea,sourcearea */ -bender.test( { - 'test save event': function() { - var editor = CKEDITOR.replace( 'editor' ), - count = 0; +function saveTest( editor ) { + var count = 0; - editor.on( 'instanceReady', function() { - editor.execCommand( 'save' ); + editor.on( 'instanceReady', function() { + editor.execCommand( 'save' ); - setTimeout( function() { - resume( function() { - assert.areSame( 1, count, 'save was fired once' ); - } ); + setTimeout( function() { + resume( function() { + assert.areSame( 1, count, 'save was fired once' ); } ); } ); + } ); - editor.on( 'save', function() { - count++; - return false; - } ); + editor.on( 'save', function() { + count++; + return false; + } ); + + wait(); +} + +bender.test( { + 'test save event in WYSIWYG mode': function() { + var editor = CKEDITOR.replace( 'editor1' ); + saveTest( editor ); + }, - wait(); + 'test save event in source mode': function() { + var editor = CKEDITOR.replace( 'editor2' , { startupMode: 'source' } ); + saveTest( editor ); } } );