Skip to content

Commit

Permalink
Merge pull request #344 from cksource/t/16968
Browse files Browse the repository at this point in the history
Paste as plain text doesn't work in Safari.
  • Loading branch information
Comandeer committed Apr 14, 2017
2 parents bae53ff + 930325e commit 41fd18b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/pastetext/plugin.js
Expand Up @@ -54,11 +54,13 @@
icons: 'pastetext,pastetext-rtl', // %REMOVE_LINE_CORE%
hidpi: true, // %REMOVE_LINE_CORE%
init: function( editor ) {
var commandName = 'pastetext';
var commandName = 'pastetext',
pasteKeystroke = !CKEDITOR.env.safari ? CKEDITOR.CTRL + CKEDITOR.SHIFT + 86 : // Ctrl + Shift + V
CKEDITOR.CTRL + CKEDITOR.ALT + CKEDITOR.SHIFT + 86; // Ctrl + Shift + Alt + V

editor.addCommand( commandName, pasteTextCmd );

editor.setKeystroke( CKEDITOR.CTRL + CKEDITOR.SHIFT + 86, commandName ); // Ctrl + Shift + V
editor.setKeystroke( pasteKeystroke, commandName );

editor.ui.addButton && editor.ui.addButton( 'PasteText', {
label: editor.lang.pastetext.button,
Expand Down
15 changes: 15 additions & 0 deletions tests/plugins/pastetext/manual/safaripasteplaintext.html
@@ -0,0 +1,15 @@
<h2>Helpers</h2>
<p><b>Some</b> <i>rich</i> <s>text</s> <sup>with</sup> <a href="http://cksource.com">link</a></p>
<h2>Editor</h2>
<textarea name="editor1" id="editor1" cols="30" rows="10">
<p>Paste the content here:</p>
<h2>And here:</h2>
</textarea>

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

CKEDITOR.replace( 'editor1' );
</script>
11 changes: 11 additions & 0 deletions tests/plugins/pastetext/manual/safaripasteplaintext.md
@@ -0,0 +1,11 @@
@bender-tags: tc, 4.7.0, 16968, pastetext
@bender-ui: collapsed
@bender-ckeditor-plugins: wysiwygarea, toolbar, undo, pastetext, sourcearea, elementspath, basicstyles, format, link

1. Copy some rich text / html.
1. Focus editor and click on the `Paste as plain text` button.
1. Paste using the shortcut shown in the notification in previous step.

**Expected:** Content is pasted as plain text.

**Unexpected:** Nothing is pasted.

0 comments on commit 41fd18b

Please sign in to comment.