Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TINY-4828: Fixed the placeholder not hiding when pasting content into the editor #5563

Merged
merged 1 commit into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/tinymce/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Version 5.3.0 (TBD)
Fixed issue with loading or pasting contents with large base64 encoded images on Safari #TINY-4715
Fixed supplementary special characters being truncated when inserted into the editor. Patch contributed by mlitwin. #TINY-4791
Fixed toolbar buttons not set to disabled when the editor is in readonly mode #TINY-4592
Fixed bug where title, width, height would be set to empty string values when updating an image and removing those using the image dialog. #TINY-4786
Fixed bug where title, width, height would be set to empty string values when updating an image and removing those using the image dialog #TINY-4786
Fixed the placeholder not hiding when pasting content into the editor #TINY-4828
Version 5.2.2 (TBD)
Fixed an issue where anchors could not be inserted on empty lines #TINY-2788
Version 5.2.1 (2020-03-25)
Expand Down
5 changes: 5 additions & 0 deletions modules/tinymce/src/core/main/ts/content/Placeholder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Editor from '../api/Editor';
import Env from '../api/Env';
import * as Events from '../api/Events';
import * as Settings from '../api/Settings';
import Delay from '../api/util/Delay';
import { EditorEvent } from '../api/util/EventDispatcher';
import VK from '../api/util/VK';
import * as Empty from '../dom/Empty';
Expand Down Expand Up @@ -114,6 +115,10 @@ const setup = (editor: Editor) => {
updatePlaceholder(e, true);
editor.on('change SetContent ExecCommand', updatePlaceholder);

// TINY-4828: Update the placeholder after pasting content. This needs to use a timeout as
// the browser doesn't update the dom until after the paste event has fired
editor.on('paste', (e) => Delay.setEditorTimeout(editor, () => updatePlaceholder(e)));

// Remove the placeholder attributes on remove
editor.on('remove', () => {
const body = editor.getBody();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ UnitTest.asynctest('webdriver.tinymce.core.content.PlaceholderTest', (success, f
tinyApi.sExecCommand('InsertOrderedList'),
sAssertPlaceholderNotExists,
sAssertCount(1)
]),
Log.stepsAsStep('TINY-4828', 'Check placeholder hides when pasting content into the editor', [
sSetContent('<p></p>'),
sAssertPlaceholderExists,
// Note: This fakes a paste event
Step.sync(() => {
editor.fire('paste');
editor.getBody().innerHTML = '<p>Pasted content</p>';
}),
sAssertPlaceholderNotExists,
sAssertCount(1)
])
].concat(browserSpecificTests), onSuccess, onFailure);
}, {
Expand Down