jQuery.fn.evolutionHtmlEditor
This plugin enables enhancing a textarea element to support editing rich HTML based on configured content filtering options (global options or content-type-specific options). This plugin fires change and keydown events on the source textarea as changes are made within the editor.
Usage
Initiates the selected textarea to render its contents for editing as HTML
$(selector).evolutionHtmlEditor(options)
Options
width
: The width of the HTML editor (default: '100%')height
: The height of the HTML editor (default: '300px')contentTypeId
: The content type identifier for the content being edited. This enables content-type-specific content filtering and functionality (default: null)applicationTypeId
: The application type identifier for the content being edited. This enables content-type-specific content filtering and functionality (default: null)applicationId
: The application identifier for the content being edited. This enables content-type-specific content filtering and functionality (default: null)placeholder
: The placeholder text to show in the editor when it is empty (default: null)enableFileUpload
: When specified, forces file uploading support on or off. When null, file uploading support is determined by reviewing the specified content type's capabilities and filtering configuration (default: null)submittable
: Enables direct submission of the content from the editor (default: false)enterToSubmitPrompt
: When configured to be submittable, the text to enable typing enter to submit the content being edited (default: null)submitLabel
: When configured to be submittable, the text shown on the submission button, when shown (default: null)beforeSubmitHtml
: When configured to be submittable, HTML that should be rendered before the submit button or prompt (default: null)afterSubmitHtml
: When configured to be submittable, the HTML that should be rendered after the submit button or prompt (default: null)autoResize
: When enabled, the editor will resize to fit the content by height (default: false)enableEnterToSubmitToggle
: When submittable, identifies whether the option to turn enter-to-submit on/off should be shown (default: false)onSubmit
: When submittable, the function that should be executed when the content is submitted. The content of the editor is provided as the only parameter to the function. (default: function(html) { })
Methods
val
Retrieves and/or sets the current value of the editor.
// Returns the current value
var value = $(selector).evolutionHtmlEditor('val')
// Sets the value
$(selector).evolutionHtmlEditor('val', newString)
focus
Focuses the editor
$(selector).evolutionHtmlEditor('focus')
saveCursorPosition
Causes the editor to save the current cursor position to be used by future insert calls.
$(select).evolutionHtmlEditor('saveCursorPosition')
insert
Inserts HTML into the editor at its current cursor position (or last saved cursor position).
$(select).evolutionHtmlEditor('insert', html)
moveTo
Moves the editor to a new parent element. This method should be used instead of other DOM manipulation logic to ensure that editor state is not lost.
$(select).evolutionHtmlEditor('moveTo', $(newparent))
ready
Returns true if the editor is initialized and ready, otherwise false. If passed a function (optional), the function is executed when the editor is ready.
var ready = $(select).evolutionHtmlEditor('ready', function() { alert('Ready!'); })
context
Retrieves and/or sets the current context identifier of the editor. When set, the value of the editor will be cleared or the last backup content for the new context identifier will be restored.
// Returns the current context identifier
var contextId = $(selector).evolutionHtmlEditor('context')
// Sets the value
$(selector).evolutionHtmlEditor('context', newContextId)
remove
Removes the editor and frees all UI resources associated to it.
$(selector).evolutionHtmlEditor('remove')