зеркало из https://github.com/mozilla/gecko-dev.git
Bug 676268 - Part 2. Use editor API instead of accessing clipboard directly r=geckoview-reviewers,snorp
Actually, Fennec accesses clipboard directly when using action bar. To allow `text/html` mime type, we should use editor API instead. Also, Fennec doesn't fire clipboard event for copy and cut since it doesn't use editor API (or `cmd_*` command). So we will be fixed by using editor API. GeckoView uses `cmd_*` command, so this doesn't occur on GV. Differential Revision: https://phabricator.services.mozilla.com/D22886 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
61804ba4b3
Коммит
7bbf5f37a7
|
@ -1,4 +1,5 @@
|
|||
// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
||||
/* vim: set ts=2 et sw=2 tw=80 filetype=javascript: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
@ -442,18 +443,11 @@ var ActionBarHandler = {
|
|||
},
|
||||
|
||||
action: function(element, win) {
|
||||
// First copy the selection text to the clipboard.
|
||||
let selectedText = ActionBarHandler._getSelectedText();
|
||||
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
|
||||
getService(Ci.nsIClipboardHelper);
|
||||
clipboard.copyString(selectedText);
|
||||
ActionBarHandler._getEditor(element, win).cut();
|
||||
|
||||
let msg = Strings.browser.GetStringFromName("selectionHelper.textCopied");
|
||||
Snackbars.show(msg, Snackbars.LENGTH_LONG);
|
||||
|
||||
// Then cut the selection text.
|
||||
ActionBarHandler._getSelection(element, win).deleteFromDocument();
|
||||
|
||||
ActionBarHandler._uninit();
|
||||
UITelemetry.addEvent("action.1", "actionbar", null, "cut");
|
||||
},
|
||||
|
@ -480,10 +474,7 @@ var ActionBarHandler = {
|
|||
},
|
||||
|
||||
action: function(element, win) {
|
||||
let selectedText = ActionBarHandler._getSelectedText();
|
||||
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
|
||||
getService(Ci.nsIClipboardHelper);
|
||||
clipboard.copyString(selectedText);
|
||||
ActionBarHandler._getEditor(element, win).copy();
|
||||
|
||||
let msg = Strings.browser.GetStringFromName("selectionHelper.textCopied");
|
||||
Snackbars.show(msg, Snackbars.LENGTH_LONG);
|
||||
|
|
Загрузка…
Ссылка в новой задаче