Hi David,
Yes, this is possible.
You can use following:
var text = aC1WebEditorObj.get_text();
aC1WebEditorObj.set_text(newText);
Following is the list of a client side object model methods:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
* CSOM methods (Note, you need to convert names to camel style in order to use it from javascript):
Using methods example:
---------- public void ApplyBackColorForSelection(string backColor) // Apply background color for current document selection
aC1WebEditorObj.applyBackColorForSelection("red");
Using properties example:
---------- public EditorModeEnum EditorMode
var prevEditorMode = aC1WebEditorObj.get_editorMode();
aC1WebEditorObj.set_editorMode("Code");
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Methods:
public void ExecuteCustomCommand(string commandName) // Execute C1WebEditor command given by parameter commandName.
Available commands: "insert_form" , "insert_textarea" , "insert_textbox" , "insert_passwordfield" , "insert_hiddenfield" , "insert_listbox" , "insert_dropdown" , "insert_radiobox" , "insert_checkbox" , "insert_imagebutton" , "insert_submitbutton" , "insert_reset" , "insert_button" , "instable" , "InsertTimeStamp" , "Full_Screen" , "WYSIWYG_Mode" , "Code_Mode" , "Split_Mode" , "Save" , "backcolor" , "forecolor" , "ShowTableBorders" , "SpellCheck" , "Word_Wrap" , "insertrow", "deleterow", "insertcolumn", "deletecolumn", "insertcell", "deletecell", "mergecell", "splitcell", "Cut", "Copy", "Paste", "Italic", "Bold", "Underline", "strikethrough" , "JustifyLeft" , "JustifyCenter" , "JustifyRight" , "JustifyFull" , "subscript" , "superscript" , "insertorderedlist" , "insertunorderedlist" , "undo" , "redo"
public void ApplyBackColorForSelection(string backColor) // Apply background color for current document selection
public void ApplyClassNameForSelection(string className) // Apply ClassName For current document selection.
public void ApplyForeColorForSelection(string foreColor) // Apply foreground color for current document selection
public void ApplyFontSizeForSelection(string fontSize) // Apply Font Size For current document selection.
public void ApplyFontForSelection(string fontName) // Apply Font For current document selection.
public void ApplyFormatForSelection(string format) // ApplyFormat for current document selection.
public void Focus(bool restoreSelectedElement) // This method sets focus to current content editable document in WYSIWYG mode, parameter restoreSelectedElement - optional.
public bool CanUndo() // Returns true if WebEditor can undo action.
public bool CanRedo() // Returns true if WebEditor can redo action
public bool CanCopy() // Returns true if Copy action is allowed.
public bool CanPaste() // Returns true if Paste action is allowed.
public void DoSpellcheck() // Run spell checking.
public void DeleteSelectionContent() // Delete content of the current selection in the WYSIWYG editor.
public void Save() // Save current document by uploading it to server.
public void SelectElement(DOMElement pElement) // Select element given by parameter pElement.
public bool IsSaved() // Returns true if text is saved, otherwise returns false.
public bool UndoAction() // Undo action.
public bool RedoAction() // Redo action.
public string GetStoredContent() // Returns previously stored HTML content.
public void StoreContent() // Store current HTML Content to internal hidden field.
public DOMElement GetSelectedElement() // Gets selected DOM element.
public string GetSelectionTextContent() // Gets string with text content of the current selection in the WYSIWYG editor.
public string GetSelectionHTMLContent() // Gets string with HTML content of the current selection in the WYSIWYG editor.
public bool IsCodeEditingMode() // Returns true if Code editing mode is active.
public void InsertHTML(string sHtmlText) // Insert HTML text at current position in WYSIWG document. Note, previous selected text will be deleted.
public object GetSelectionBookmark() // Gets Current Selection Bookmark object that can be used as parameter for method MoveToSelectionBookmark. (Applies to WYSIWYG editor).
public void MoveToSelectionBookmark(object aSelectionBookmark) // Restore previously saved selection. (Applies to WYSIWYG editor).
public string QuerySelectionClass() // Returns class what used by current selected element.
public string QueryCommandState(string commandName) // Returns state ("ENABLED", "CHECKED", "DISABLED") of the basic command given by parameter commandName.
public string QueryCommandValue(string commandName) // Returns value of the basic command given by parameter commandName. Returns null if command not enabled or not exists.
public void RefreshPathSelector() // Refresh PathSelector and toolbar buttons states.
// Properties:
public string AccessKey // Gets or sets the access key that allows you to quickly navigate to the WebEditor.
public string ClientObjectID // Gets ID of the client side object associated with the control.
public EditorModeEnum EditorMode // Editor mode (WYSIWYG=0/Code=1/Split=2). Value for this property can be specified by string or int value.
public bool FullScreenMode // FullScreen Mode. Set this property to true if you want to switch editor to FullScreen Mode. All client area of the page will be covered by WebEditor.
public string FullScreenModeContainerId // Full screen mode container ID. Use this property to specify container which will be used as the parent control for FullScreenMode instead of client's area on the web page.
public bool ShowSpellCheckerDialog // Indicates whether to show SpellChecker dialog or just allow a user to select suggestions from context menu.
public bool ShowTableBorders // Show table borders in WYSIWYG mode.
public string Text // Gets or Sets WebEditor Text.
public bool WordWrap // Indicates whether to use word wrap in source editing mode.
public string AjaxRequestImageUrl // Url to image what will be displayed on ajax requests.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Best regards, Dmitri.