Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Minor code simplification.
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Apr 5, 2018
1 parent c9db732 commit 72f1584
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/view/placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,19 @@ export function attachPlaceholder( view, element, placeholderText, checkFunction
* @param {module:engine/view/element~Element} element
*/
export function detachPlaceholder( view, element ) {
const document = element.document;
const doc = element.document;

if ( documentPlaceholders.has( document ) ) {
const info = documentPlaceholders.get( document ).get( element );
if ( info.removeCkClass ) {
view.change( writer => writer.removeClass( 'ck', element ) );
}
view.change( writer => {
if ( documentPlaceholders.has( doc ) ) {
const info = documentPlaceholders.get( doc ).get( element );

documentPlaceholders.get( document ).delete( element );
}
if ( info.removeCkClass ) {
writer.removeClass( 'ck', element );
}

documentPlaceholders.get( doc ).delete( element );
}

view.change( writer => {
writer.removeClass( 'ck-placeholder', element );
writer.removeAttribute( 'data-placeholder', element );
} );
Expand Down

0 comments on commit 72f1584

Please sign in to comment.