-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDocumentExecCommand.js
More file actions
28 lines (24 loc) · 968 Bytes
/
DocumentExecCommand.js
File metadata and controls
28 lines (24 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
installClass('Document', function(documentPrototype) {
'use strict';
<include src="editing.js">
<include src="commands/select_all_command.js">
/**
* @this {!Document} document
* @param {string} commandName
* @param {boolean} userInterface
* @param {string} commandValue
* @return {boolean}
*/
function execCommandInJavaScript(commandName, userInterface, commandValue) {
var commandFunction = editing.lookupCommand(commandName);
if (!commandFunction)
throw new Error('No such command ' + commandName);
return commandFunction(document, userInterface, commandValue);
}
// For ease of debugging, we use named function |execCommandInJavaScript| to
// see it in stack trace.
documentPrototype['execCommandInJavaScript'] = execCommandInJavaScript;
});