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

Use editor's title for new preview window #4915

Merged
merged 6 commits into from
Oct 4, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ New Features:
* [#4807](/~https://github.com/ckeditor/ckeditor4/issues/4807): [Chrome] Improve the performance of pasting large images. Thanks to [FlowIT-JIT](/~https://github.com/FlowIT-JIT)!
* [#4850](/~https://github.com/ckeditor/ckeditor4/issues/4850): Added support for loading [content templates](https://ckeditor.com/cke4/addon/templates) from HTML files. Thanks to [Fynn96](/~https://github.com/Fynn96)!
* [#4874](/~https://github.com/ckeditor/ckeditor4/issues/4874): Added the [`config.clipboard_handleImages`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-clipboard_handleImages) configuration option for enabling and disabling built-in support for pasting and dropping images in the [Clipboard](https://ckeditor.com/cke4/addon/clipboard) plugin. Thanks to [FlowIT-JIT](/~https://github.com/FlowIT-JIT)!
* [#4858](/~https://github.com/ckeditor/ckeditor4/issues/4858): Fixed: [Autolink](https://ckeditor.com/cke4/addon/autolink) plugin incorrectly escapes `&` characters when pasting links into the editor.
* [#4026](/~https://github.com/ckeditor/ckeditor4/issues/4026): [Preview](https://ckeditor.com/cke4/addon/preview) plugin now uses [`editor#title`](http://localhost/ckeditor4-docs/build/docs/ckeditor4/latest/api/CKEDITOR_editor.html#property-title) property for the title of the preview window. Thanks to [Ely](/~https://github.com/Elyasin)!

Fixed Issues:

Expand All @@ -35,6 +35,7 @@ Fixed Issues:
* [#4790](/~https://github.com/ckeditor/ckeditor4/issues/4790): Fixed: Printing page is invoked before the printed page is fully loaded.
* [#4874](/~https://github.com/ckeditor/ckeditor4/issues/4874): Fixed: Built-in support for pasting and dropping images in the [Clipboard](https://ckeditor.com/cke4/addon/clipboard) plugin restricts third party plugins from handling image pasting. Thanks to [FlowIT-JIT](/~https://github.com/FlowIT-JIT)!
* [#4888](/~https://github.com/ckeditor/ckeditor4/issues/4888): Fixed: [`CKEDITOR.dialog#setState()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dialog.html#method-setState) method throws error when there is no "Ok" button in the dialog.
* [#4858](/~https://github.com/ckeditor/ckeditor4/issues/4858): Fixed: [Autolink](https://ckeditor.com/cke4/addon/autolink) plugin incorrectly escapes `&` characters when pasting links into the editor.

API Changes:

Expand Down
2 changes: 1 addition & 1 deletion plugins/preview/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
function createPreviewHtml( editor, callback ) {
var pluginPath = CKEDITOR.plugins.getPath( 'preview' ),
config = editor.config,
title = editor.lang.preview.preview,
title = editor.title,
baseTag = generateBaseTag();

if ( config.fullPage ) {
Expand Down
13 changes: 13 additions & 0 deletions tests/plugins/preview/manual/previewtitle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div id="editor">
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit.</p>
</div>

<script>
if ( CKEDITOR.env.safari ) {
bender.ignore();
}

CKEDITOR.replace( 'editor', {
title: 'Some fancy title'
} );
</script>
8 changes: 8 additions & 0 deletions tests/plugins/preview/manual/previewtitle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@bender-tags: 4.17.0, feature, 4026
@bender-ui: collapsed
@bender-ckeditor-plugins: wysiwygarea, preview, font, colorbutton, format, clipboard, pagebreak, toolbar, floatingspace, link, image2

1. Click "Preview" button.
2. Check the title of the newly opened window.

**Expected** Title equals "Some fancy title".
20 changes: 20 additions & 0 deletions tests/plugins/preview/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ bender.editor = {
};

bender.test( {
// (#4026)
'test title of preview': function() {
var tc = this,
editor = tc.editor;

editor.title = 'Test title';
editor.once( 'contentPreview', function( event ) {
event.cancel();

tc.resume( function() {
assert.isMatching( '<title>' + editor.title + '</title>', event.data.dataValue,
'Preview title is editor\'s title.' );
} );
}, null, null, 1 );

editor.execCommand( 'preview' );

tc.wait();
},

'test processing of data on contentPreview': function() {
var tc = this,
editor = tc.editor;
Expand Down