-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5415 from ckeditor/t/5414
Fire the `change` event after uploading is done
- Loading branch information
Showing
13 changed files
with
266 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<p>Note, this test uses a real Cloud Service connection, so you might want to be on-line 😉.</p> | ||
|
||
<div id="editor"> | ||
<p>Drop image here:</p> | ||
</div> | ||
|
||
<div id="changes"></div> | ||
|
||
<script> | ||
( function() { | ||
bender.tools.ignoreUnsupportedEnvironment( 'easyimage' ); | ||
|
||
var changeLog = CKEDITOR.document.getById( 'changes' ), | ||
i = 0; | ||
|
||
CKEDITOR.replace( 'editor', { | ||
cloudServices_uploadUrl: easyImageTools.CLOUD_SERVICES_UPLOAD_GATEWAY, | ||
cloudServices_tokenUrl: easyImageTools.CLOUD_SERVICES_TOKEN_URL, | ||
on: { | ||
change: function( evt ) { | ||
var change = CKEDITOR.dom.element.createFromHtml( '<p>Change #' + ( ++i ) + '</p>' ); | ||
|
||
changeLog.append( change ); | ||
console.log( 'change ' + i, evt.editor.getData() ); | ||
} | ||
} | ||
} ); | ||
} ) (); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@bender-tags: 4.20.2, bug, 5414 | ||
@bender-ui: collapsed | ||
@bender-ckeditor-plugins: wysiwygarea, toolbar, easyimage, undo | ||
@bender-include: ../_helpers/tools.js | ||
|
||
1. Drop image into the editor. | ||
1. Wait for its upload. | ||
|
||
**Expected** There are two change events noted under the editor. | ||
**Unexpected** There is only one change event noted under the editor. | ||
|
||
**Note** You can check editor's data for each `change` event in the browser console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<div id="editor"> | ||
<p>Drop some file here:</p> | ||
</div> | ||
|
||
<div id="changes"></div> | ||
|
||
<script> | ||
( function() { | ||
var changeLog = CKEDITOR.document.getById( 'changes' ), | ||
i = 0; | ||
|
||
CKEDITOR.once( 'instanceReady', function() { | ||
bender.tools.ignoreUnsupportedEnvironment( 'uploadfile' ); | ||
} ); | ||
|
||
CKEDITOR.replace( 'editor', { | ||
uploadUrl: 'fakeUrl', | ||
on: { | ||
change: function( evt ) { | ||
var change = CKEDITOR.dom.element.createFromHtml( '<p>Change #' + ( ++i ) + '</p>' ); | ||
|
||
changeLog.append( change ); | ||
console.log( 'change ' + i, evt.editor.getData() ); | ||
} | ||
} | ||
} ); | ||
} ) (); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@bender-tags: 4.20.2, bug, 5414 | ||
@bender-ui: collapsed | ||
@bender-ckeditor-plugins: wysiwygarea, toolbar, uploadfile, undo | ||
@bender-include: ../../uploadwidget/manual/_helpers/xhr.js | ||
|
||
1. Drop some file into the editor. | ||
1. Wait for its upload. | ||
|
||
**Expected** There are two change events noted under the editor. | ||
**Unexpected** There is only one change event noted under the editor. | ||
|
||
**Note** You can check editor's data for each `change` event in the browser console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<h2>With <code>image</code> plugin</h2> | ||
<div id="image"> | ||
<p>Drop image here:</p> | ||
</div> | ||
|
||
<div id="changes-image"></div> | ||
|
||
<h2>With <code>image2</code> plugin</h2> | ||
<div id="image2"> | ||
<p>Drop image here:</p> | ||
</div> | ||
|
||
<div id="changes-image2"></div> | ||
|
||
<script> | ||
( function() { | ||
CKEDITOR.once( 'instanceReady', function() { | ||
bender.tools.ignoreUnsupportedEnvironment( 'uploadimage' ); | ||
} ); | ||
|
||
creatEditorWithChangelog( 'image', { | ||
extraPlugins: 'image' | ||
} ); | ||
creatEditorWithChangelog( 'image2', { | ||
extraPlugins: 'image2' | ||
} ); | ||
|
||
function creatEditorWithChangelog( editorId, userConfig ) { | ||
var changeLog = CKEDITOR.document.getById( 'changes-' + editorId ), | ||
i = 0, | ||
commonConfig = { | ||
uploadUrl: 'fakeUrl', | ||
on: { | ||
change: function( evt ) { | ||
var change = CKEDITOR.dom.element.createFromHtml( '<p>Change #' + ( ++i ) + '</p>' ); | ||
|
||
changeLog.append( change ); | ||
console.log( 'change ' + i, evt.editor.getData() ); | ||
} | ||
} | ||
}, | ||
config = CKEDITOR.tools.object.merge( commonConfig, userConfig || {} ); | ||
|
||
CKEDITOR.replace( editorId, config ); | ||
} | ||
} ) (); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
@bender-tags: 4.20.2, bug, 5414 | ||
@bender-ui: collapsed | ||
@bender-ckeditor-plugins: wysiwygarea, toolbar, uploadimage, undo | ||
@bender-include: ../../uploadwidget/manual/_helpers/xhr.js | ||
|
||
1. Drop image into the editor. | ||
1. Wait for its upload. | ||
|
||
**Expected** There are two change events noted under the editor. | ||
**Unexpected** There is only one change event noted under the editor. | ||
|
||
**Note** You can check editor's data for each `change` event in the browser console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters