Wednesday, June 26, 2013

contentEditable cross browser WYSIWYG

http://msdn.microsoft.com/en-us/library/ms533049(VS.85).aspx 

execCommand method
Syntax
object.execCommand(cmdID, showUI, value)

queryCommandEnabled method
Syntax
var flag = object.queryCommandEnabled(cmdID)


queryCommandIndeterm method
Syntax
object.queryCommandIndeterm(cmdID)

queryCommandState method
Syntax
object.queryCommandState(cmdID)

queryCommandSupported method
Syntax
var flag = object.queryCommandSupported(cmdID)

queryCommandValue method
Syntax
object.queryCommandValue(cmdID)


Command Return Description
AbsolutePosition false Required. Variant of type Boolean specifying whether the element is to be absolutely positioned.
BackColor false Required. Variant of type String that specifies a color name or a six-digit hexadecimal RGB value, with or without a leading hash mark.
BackgroundImageCache false Required. Variant of type Boolean specifying whether this feature is to be on or off.
Bold false Optional
Copy false Optional
CreateBookmark false Required. Variant of type String that specifies a valid anchor name. Providing an empty string will cause the command to fail.
CreateLink Optional. This command displays a dialogue box if the bUserInterface argument of execCommand is set to true or omitted. It does not display a dialogue box if the argument is set to false or null and the vValue parameter is present (even if it's null). Optional. Variant of type String that specifies a URL.
Cut false Optional
Delete false Optional
FontName false Required. Variant of type String that specifies a font name or font list, as described by the font attribute.
FontSize false Required. Variant of type Integer or String that specifies the font size. This must be a value between 1 and 7, inclusive.
ForeColor false Required. Variant of type String that specifies a color name or a six-digit hexadecimal RGB value, with or without a leading hash mark
FormatBlock false Required. Variant of type String that specifies a valid block format tag.
Indent false Optional
InsertButton false Optional. Variant of type String that specifies an id attribute for the button control.
InsertFieldset false Optional. Variant of type String that specifies an id attribute for the box. May be set to null or omitted.
InsertHorizontalRule false Optional. Variant of type String that specifies an id attribute for the horizontal line. May be set to null or omitted.
InsertIFrame false Optional. Variant of type String that specifies an id attribute for the inline frame. May be set to null or omitted.
InsertImage Optional. This command displays a dialogue box if the bUserInterface argument of execCommand is set to true or omitted. It does not display a dialogue box if the argument is set to false or null and the vValue parameter is present (even if it's null). Optional. Variant of type String that specifies the path and file name of the image to insert. If the command displays a dialogue box, this parameter is ignored.
InsertInputButton false Optional. Variant of type String that specifies an id attribute for the button control. May be set to null or omitted.
InsertInputCheckbox false Optional. Variant of type String that specifies an id attribute for the check box control. May be set to null or omitted.
InsertInputFileUpload false
InsertInputHidden false Optional. Variant of type String that specifies an id attribute for the check box control. May be set to null or omitted.
InsertInputImage false Optional. Variant of type String that specifies an id attribute for the check box control. May be set to null or omitted.
InsertInputPassword false Optional. Variant of type String that specifies an id attribute for the check box control. May be set to null or omitted.
InsertInputReset false Optional. Variant of type String that specifies an id attribute for the check box control. May be set to null or omitted.
InsertInputSubmit false Optional. Variant of type String that specifies an id attribute for the check box control. May be set to null or omitted.
InsertInputText false Optional. Variant of type String that specifies an id attribute for the check box control. May be set to null or omitted.
InsertMarquee false Optional. Variant of type String that specifies an id attribute for the marquee. May be set to null or omitted.
InsertOrderedList false Optional. Variant of type String that specifies an id attribute for the ordered list. May be set to null or omitted.
var tr = document.body.createTextRange();
tr.execCommand("InsertOrderedList", false, 'listId');
InsertParagraph false Optional. Variant of type String that specifies an id attribute for the paragraph. May be set to null or omitted.
InsertSelectDropdown false Optional. Variant of type String that specifies an id attribute for the drop-down selection control. May be set to null or omitted.
InsertSelectListbox false Optional. Variant of type String that specifies an id attribute for the list box selection control. May be set to null or omitted.
InsertTextArea false Optional. Variant of type String that specifies an id attribute for the text input control. May be set to null or omitted.
InsertUnorderedList false Optional. Variant of type String that specifies an id attribute for the unordered list. May be set to null or omitted.
var tr = document.body.createTextRange();
tr.execCommand("InsertUnorderedList", false, 'listId');
Italic false Optional
JustifyFull false Optional
JustifyLeft false Optional
JustifyNone false Optional
JustifyRight false Optional
LiveResize false Required. Variant of type Boolean specifying whether this feature is to be on or off.
MultipleSelection false Required. Variant of type Boolean specifying whether this feature is to be on or off. If multiple items are selected when the multiple selection feature is turned off, the items will remain selected.
Outdent false Optional
OverWrite false Optional. Variant of type Boolean that specifies the text-entry mode. If this value is set to true or null, the text-entry mode is overwrite. If this value is set to false (the default), the text-entry mode is insert.
Paste false Optional
Print false Optional
Refresh false Optional
RemoveFormat false Optional
SaveAs Optional. This command displays a dialogue box if nCmdExecOpt is set to MSOCMDEXECOPT_DODEFAULT, MSOCMDEXECOPT_PROMPTUSER, or null. It does not display a dialogue box if the argument is set to MSOCMDEXECOPT_DONTPROMPTUSER.This parameter is ignored. The Save HTML Document dialog box is always displayed. Optional. Variant of type String that specifies the path and file name of the file to which to save the Web page. When the path contains more than one folder name, separate the folder names with two backward slashes (\\).
SelectAll false Optional
SizeToControl false Optional
SizeToControlHeight false
StrikeThrough false
Subscript false
Superscript false
Underline false Optional
Undo false Optional,
Unlink false Optional
Unselect false Optional

No comments:

Post a Comment