octo-deno/lib/make/command.ts

85 lines
2.1 KiB
TypeScript

/* 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/. */
import random from "../random/random.ts";
import colors from "./colors.ts";
import uri from "./uri.ts";
import font from "./fonts.ts";
import text from "./text.ts";
export default class command {
static data() {
return {
backcolor: () => colors.any(),
bold: null,
contentReadOnly: () => random.bool(),
copy: null,
createlink: () => uri.any(),
cut: null,
decreasefontsize: null,
delete: null,
enableInlineTableEditing: () => random.bool(),
enableObjectResizing: () => random.bool(),
fontname: () => font.family(),
fontsize: () => font.relativeSize(),
formatblock: [
"p",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"ol",
"ul",
"pre",
"address",
"blockquote",
"dl",
"div"
],
forwarddelete: null,
forecolor: () => colors.any(),
gethtml: null,
heading: null,
hilitecolor: () => colors.any(),
increasefontsize: null,
indent: null,
insertBrOnReturn: () => random.bool(),
inserthorizontalrule: null,
// 'inserthtml': function () { },
insertlinebreak: null,
insertimage: () => uri.any(),
insertorderedlist: null,
insertparagraph: null,
inserttext: () => text.any(),
insertunorderedlist: null,
italic: null,
justifycenter: null,
justifyfull: null,
justifyleft: null,
justifyright: null,
outdent: null,
paste: null,
redo: null,
removeformat: null,
selectall: null,
strikethrough: null,
styleWithCSS: () => random.bool(),
subscript: null,
superscript: null,
underline: null,
undo: null,
unlink: null
};
}
static commandName() {
return random.item(Object.keys(command.data()));
}
static value(name) {
return random.pick(command.data()[name]);
}
}