Editor JAVASCRIPT UI Component API

Editor Javascript API

Class

Editor

smartEditor represents an advanced HTML text editor which can simplify web content creation or be a replacement of your HTML/Markdown Text Areas.

Selector

smart-editor

Properties

Events

Methods

Properties

animation"none" | "simple" | "advanced"

Sets or gets the animation mode. Animation is disabled when the property is set to 'none'

Default value

"advanced"

Example

Set the animation property.

 <smart-editor animation='none'></smart-editor>

Set the animation property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.animation = 'simple';

Get the animation property.

 const editor = document.querySelector('smart-editor');
 let animation = editor.animation;

autoLoadboolean

Automatically loads the last saved state of the editor (from local storage) on element initialization. An id must be provided in order to load a previously saved state.

Default value

false

Example

Set the autoLoad property.

 <smart-editor auto-load></smart-editor>

Set the autoLoad property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.autoLoad = false;

Get the autoLoad property.

 const editor = document.querySelector('smart-editor');
 let autoLoad = editor.autoLoad;

autoSaveboolean

Automatically saves the current content of the editor. Saving happens at time intervas determined by the autoSaveInterval property while the element on focus. An id must be provided to the element in order to store the state.

Default value

false

Example

Set the autoSave property.

 <smart-editor auto-save></smart-editor>

Set the autoSave property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.autoSave = false;

Get the autoSave property.

 const editor = document.querySelector('smart-editor');
 let autoSave = editor.autoSave;

autoSaveIntervalboolean

The interval that determines the interval to automatically save the state of the Editor when the autoSave property is set.

Default value

false

Example

Set the autoSaveInterval property.

 <smart-editor auto-save-interval></smart-editor>

Set the autoSaveInterval property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.autoSaveInterval = false;

Get the autoSaveInterval property.

 const editor = document.querySelector('smart-editor');
 let autoSaveInterval = editor.autoSaveInterval;

chartCountFormatFunctionfunction | null

A formatting function for the char counter. Takes two arguments:

  • chars - the current number of characters inside the Editor.
  • maxCharCount - the maximum number of characters inside the Editor.

Example

Set the chartCountFormatFunction property.

 <smart-editor chart-count-format-function='function (chars, maxCharCount) { return 'Chars: + chars }'></smart-editor>

Set the chartCountFormatFunction property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.chartCountFormatFunction = function (chars, maxCharCount) { return maxCharCount - chars + 'left';

Get the chartCountFormatFunction property.

 const editor = document.querySelector('smart-editor');
 let chartCountFormatFunction = editor.chartCountFormatFunction;

dataExportobject

Sets the Editor's Data Export options.

Properties

styleobject

Sets a custom style object of the dataExport.

Get the style property.

 const editor = document.querySelector('smart-editor');
 let style = editor.dataExport.style;

fileNamestring

Sets the exported file's name.

Default value

"smartScheduler"

Get the fileName property.

 const editor = document.querySelector('smart-editor');
 let fileName = editor.dataExport.fileName;

pageOrientationstring

Sets the page orientation, when exporting to PDF.

Default value

"portrait"

Get the pageOrientation property.

 const editor = document.querySelector('smart-editor');
 let pageOrientation = editor.dataExport.pageOrientation;

disabledboolean

Enables or disables the Editor.

Default value

false

Example

Set the disabled property.

 <smart-editor disabled></smart-editor>

Set the disabled property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.disabled = false;

Get the disabled property.

 const editor = document.querySelector('smart-editor');
 let disabled = editor.disabled;

disableEditingboolean

Disables content editing inside Editor.

Default value

false

Example

Set the disableEditing property.

 <smart-editor disable-editing></smart-editor>

Set the disableEditing property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.disableEditing = false;

Get the disableEditing property.

 const editor = document.querySelector('smart-editor');
 let disableEditing = editor.disableEditing;

editMode"html" | "markdown"

Determines the edit mode for the Editor. By default the editor's content accepts and parses HTML. However if set to 'markdown' the Editor can be used as a full time Markdown Editor by parsing the makrdown to HTML in preview mode.

Default value

"html"

Example

Set the editMode property.

 <smart-editor edit-mode='markdown,html'></smart-editor>

Set the editMode property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.editMode = 'html,markdown';

Get the editMode property.

 const editor = document.querySelector('smart-editor');
 let editMode = editor.editMode;

enableHtmlEncodeboolean

Determines whether the HTML returned from the value property or displayed by Preview mode is encoded or not

Default value

false

Example

Set the enableHtmlEncode property.

 <smart-editor enable-html-encode></smart-editor>

Set the enableHtmlEncode property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.enableHtmlEncode = false;

Get the enableHtmlEncode property.

 const editor = document.querySelector('smart-editor');
 let enableHtmlEncode = editor.enableHtmlEncode;

enableTabKeyboolean

Determines whether the Tab key can insert tab chars inside the Editor or change focus (default)

Default value

false

Example

Set the enableTabKey property.

 <smart-editor enable-tab-key></smart-editor>

Set the enableTabKey property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.enableTabKey = false;

Get the enableTabKey property.

 const editor = document.querySelector('smart-editor');
 let enableTabKey = editor.enableTabKey;

hideToolbarboolean

Determines whether the Toolbar is hidden or not.

Default value

false

Example

Set the hideToolbar property.

 <smart-editor hide-toolbar></smart-editor>

Set the hideToolbar property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.hideToolbar = false;

Get the hideToolbar property.

 const editor = document.querySelector('smart-editor');
 let hideToolbar = editor.hideToolbar;

hideInlineToolbarboolean

Determines whether the Inline Toolbar is hidden or not.

Default value

false

Example

Set the hideInlineToolbar property.

 <smart-editor hide-inline-toolbar></smart-editor>

Set the hideInlineToolbar property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.hideInlineToolbar = false;

Get the hideInlineToolbar property.

 const editor = document.querySelector('smart-editor');
 let hideInlineToolbar = editor.hideInlineToolbar;

innerHTMLstring

Sets the content of the Editor. Similar to value property allows to set the content of the editor.

Default value

"en"

Example

Set the innerHTML property.

 <smart-editor inner-h-t-m-l='

New Content added

'></smart-editor>

Set the innerHTML property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.innerHTML = 'Some Other text then ...';

Get the innerHTML property.

 const editor = document.querySelector('smart-editor');
 let innerHTML = editor.innerHTML;

inlineToolbarOffsetnumber[]

Defines an offset(x,y) for the Inline Toolbar positioning on the page.

Default value

[0, -5]

Example

Set the inlineToolbarOffset property.

 <smart-editor inline-toolbar-offset='[0, 0]'></smart-editor>

Set the inlineToolbarOffset property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.inlineToolbarOffset = [0, -10];

Get the inlineToolbarOffset property.

 const editor = document.querySelector('smart-editor');
 let inlineToolbarOffset = editor.inlineToolbarOffset;

iframeSettingsobject

Determines the iframe settings of the Editor. When enabled the contents of the Editor are placed inside an iframe, isolated in a separate dom. The element allows to insert external resources into the iframe if needed.

Properties

attributesobject

Determines the attributes and their values that will be set to the iframe. Here's how to define attributes:

attributes: { height: 500 }

Get the attributes property.

 const editor = document.querySelector('smart-editor');
 let attributes = editor.iframeSettings[0].attributes;

enabledboolean

Enables/Disables the usage of an iframe for the content of the Editor.

Default value

false

Get the enabled property.

 const editor = document.querySelector('smart-editor');
 let enabled = editor.iframeSettings[0].enabled;

resourcesstring

Determines the resources like scripts/styles that will be imported into the iframe. Here's how to define resources:

resources: { 'style': { href: 'styles.css' }, 'script': { src: 'index.js', type: 'module' }} 

Default value

"portrait"

Get the resources property.

 const editor = document.querySelector('smart-editor');
 let resources = editor.iframeSettings[0].resources;

pasteFormat"prompt" | "plainText" | "keepFormat" | "cleanFormat"

Determines the format of the content that will be pasted inside the Editor.

Default value

"keepFormat"

Example

Set the pasteFormat property.

 <smart-editor paste-format='prompt'></smart-editor>

Set the pasteFormat property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.pasteFormat = 'plainText';

Get the pasteFormat property.

 const editor = document.querySelector('smart-editor');
 let pasteFormat = editor.pasteFormat;

localestring

Sets or gets the language. Used in conjunction with the property messages.

Default value

"en"

Example

Set the locale property.

 <smart-editor locale='de'></smart-editor>

Set the locale property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.locale = 'fr';

Get the locale property.

 const editor = document.querySelector('smart-editor');
 let locale = editor.locale;

maxCharCountnumber

Sets a limit on the number of chars inside the Editor.

Example

Set the maxCharCount property.

 <smart-editor max-char-count='1000'></smart-editor>

Set the maxCharCount property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.maxCharCount = 2000;

Get the maxCharCount property.

 const editor = document.querySelector('smart-editor');
 let maxCharCount = editor.maxCharCount;

messagesobject

Sets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property language.

Default value




"en": {

"propertyUnknownName": "Invalid property name: '{{name}}'!",

"propertyUnknownType": "'{{name}}' property is with undefined 'type' member!",

"propertyInvalidValue": "Invalid '{{name}}' property value! Actual value: '{{actualValue}}', Expected value: '{{value}}'!",

"propertyInvalidValueType": "Invalid '{{name}}' property value type! Actual type: '{{actualType}}', Expected type: '{{type}}'!",

"methodInvalidValueType": "Invalid '{{name}}' method argument value type! Actual type: '{{actualType}}', Expected type: '{{type}}' for argument with index: '{{argumentIndex}}'!",

"methodInvalidArgumentsCount": "Invalid '{{name}}' method arguments count! Actual arguments count: '{{actualArgumentsCount}}', Expected at least: '{{argumentsCount}}' argument(s)!",

"methodInvalidReturnType": "Invalid '{{name}}' method return type! Actual type: '{{actualType}}', Expected type: '{{type}}'!",

"elementNotInDOM": "Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.",

"moduleUndefined": "Module is undefined.",

"missingReference": "{{elementType}}: Missing reference to '{{files}}'.",

"htmlTemplateNotSuported": "{{elementType}}: Web Browser doesn't support HTMLTemplate elements.",

"invalidTemplate": "{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM.",

"invalidValue": "{{elementType}}: Invalid {{property}} value. {{property}} should be of type {{typeOne}} or {{typeTwo}}.",

"incorrectArgument": "{{elementType}}: Incorrect argument {{argumentName}} in method {{methodName}}.",

"permissionsRequired": "{{elementType}}: Permissions are required for the following action {{actionName}}.",

"ok": "Ok",

"cancel": "Cancel",

"alignLeft": "Align Left",

"alignCenter": "Align Center",

"alignRight": "Align Right",

"alignJustify": "Align Justify",

"segoeUi": "Segoe UI",

"arial": "Arial",

"georgia": "Georgia",

"impact": "Impact",

"tahoma": "Tahoma",

"timesNewRoman": "Times New Roman",

"verdana": "Verdana",

"p": "Paragraph",

"pre": "Code",

"code": "Code",

"blockquote": "Quotation",

"h1": "Heading 1",

"h2": "Heading 2",

"h3": "Heading 3",

"h4": "Heading 4",

"h5": "Heading 5",

"h6": "Heading 6",

"bold": "Bold",

"italic": "Italic",

"underline": "Underline",

"strikethrough": "Strikethrough",

"orderedlist": "Ordered List",

"unorderedlist": "Unordered List",

"subscript": "Subscript",

"superscript": "Superscript",

"alignment": "Alignments",

"fontname": "Font Name",

"fontsize": "Font Size",

"formats": "Formats",

"backgroundcolor": "Background Color",

"fontcolor": "Font Color",

"redo": "Redo",

"undo": "Undo",

"indent": "Indent",

"outdent": "Outdent",

"createlink": "Hyperlink",

"hyperlink": "Hyperlink",

"editlink": "Hyperlink",

"removelink": "Remove link",

"openlink": "Open link",

"image": "Image",

"table": "Table",

"lowercase": "Lower Case",

"uppercase": "Upper Case",

"print": " Print",

"cut": " Cut",

"copy": " Copy",

"paste": " Paste",

"clearformat": "Clear Format",

"fullscreen": "Full Screen",

"restore": "Restore Screen",

"sourcecode": "Source Code",

"preview": "Preview",

"splitmode": "Split Editor",

"address": "Web Address",

"text": "Display Text",

"addressPlaceholder": "http://example.com",

"textPlaceholder": "Enter Text",

"targetPlaceholder": "Select Target",

"titlePlaceholder": "Enter a Title",

"urlPlaceholder": "http://example.com/image.png",

"captionPlaceholder": "Caption",

"altPlaceholder": "Alternative Text",

"widthPlaceholder": "auto",

"heightPlaceholder": "auto",

"target": "Open Link in",

"linkBlankDescr": "New Window",

"linkSelfDescr": "Same Window",

"linkParentDescr": "Parent Frame",

"linkTopDescr": "Full Body of the Window",

"linkCustomDescr": "Custom Frame Name",

"title": "Title",

"url": "You can also provide the URL to an image",

"width": "Width",

"height": "Height",

"alt": "Alternative Text",

"caption": "Caption",

"display": "Display",

"displayPlaceholder": "Display",

"displayBlock": "Block",

"displayInline": "Inline",

"draggable": "Enable Dragging",

"resizable": "Enable Resizing",

"browse": "Browse",

"connectionError": "{{elementType}}: File Upload requires connection to the server.",

"wrongItemIndex": "{{elementType}}: There is no file with such an index in the list of uploaded files.",

"tooLongFileName": "{{elementType}}: File name is too long.",

"totalFiles": "Total files: ",

"cancelFile": "Cancel File",

"dashedborders": "Dashed Borders",

"altrows": "Alternate Rows",

"insertRowBefore": "Insert Row Before",

"insertRowAfter": "Insert Row After",

"deleteRow": "Delete Row",

"insertColumnLeft": "Insert Column Left",

"insertColumnRight": "Insert Column Right",

"deleteColumn": "Delete Column",

"alignTop": "Align Top",

"alignMiddle": "Align Middle",

"alignBottom": "Align Bottom",

"delete": "Delete",

"tablerows": "Table Rows",

"tablecolumns": "Table Columns",

"tablevalign": "Table Cell Vertical Align",

"tablestyle": "Table Style",

"tableheader": "Table Header",

"buttonLabel": "Custom Table",

"pasteLabel": "Choose the paste format action:",

"cols": "Columns",

"rows": "Rows",

"alphabet": "abcdefghijklmnopqrstuvwxyz",

"header": "Header",

"column": "Column",

"plainText": "Plain Text",

"keepFormat": "Keep Format",

"cleanFormat": "Clean Format",

"roleDescription": "Text Editor",

"iframeTitle": "Editor Content is Encloused in it's own DOM inside an iFrame",

"toolbarButtonAriaLabel": "Toolbar Toggle Button",

"primaryToolbarAriaLabel": "Primary Toolbar",

"secondaryToolbarAriaLabel": "Secondary Toolbar",

"inputAriaLabel": "Enter Text"

}

Example

Set the messages property.

 <smart-editor messages='{"de":{"invalidValue":"{{elementType}}: Ungültiger {{property}} Wert. {{property}} sollte vom Typ {{typeOne}} oder {{typeTwo}} sein.","incorrectArgument":"{{elementType}}: Falsches Argument {{argumentName}} in Methode {{methodName}}.","permissionsRequired":"{{elementType}}: Für die folgende Aktion {{actionName}} sind Berechtigungen erforderlich.","ok":"Ok","cancel":"Stornieren","alignLeft":"Linksbündig","alignCenter":"Im Zentrum anordnen","alignRight":"Rechts ausrichten","alignJustify":"Ausrichten Ausrichten","segoeUi":"Segoe UI","arial":"Arial","georgia":"Georgia","impact":"Impact","tahoma":"Tahoma","timesNewRoman":"Times New Roman","verdana":"Verdana","p":"Absatz","pre":"Code","code":"Code","blockquote":"Zitat","h1":"Überschrift 1","h2":"Überschrift 2","h3":"Überschrift 3","h4":"Überschrift 4","h5":"Überschrift 5","h6":"Überschrift 6","bold":"Fett gedruckt","italic":"Kursiv","underline":"Unterstreichen","strikethrough":"Durchgestrichen","orderedlist":"Bestellliste","unorderedlist":"Ungeordnete Liste","subscript":"Index","superscript":"Superscript","alignment":"Ausrichtungen","fontname":"Schriftartenname","fontsize":"Schriftgröße","formats":"Formate","backgroundcolor":"Hintergrundfarbe","fontcolor":"Schriftfarbe","redo":"Wiederholen","undo":"Rückgängig machen","indent":"Einzug","outdent":"Outdent","createlink":"Hyperlink","hyperlink":"Hyperlink","editlink":"Hyperlink","removelink":"Link entfernen","openlink":"Verbindung öffnen","image":"Bild","table":"Tabelle","lowercase":"Kleinbuchstaben","uppercase":"Großbuchstaben","print":"Drucken","cut":"Schnitt","copy":"Kopieren","paste":" Einfügen","clearformat":"Format löschen","fullscreen":"Vollbild","restore":"Bildschirm wiederherstellen","sourcecode":"Quellcode","preview":"Vorschau","splitmode":"Geteilter Editor","address":"Webadresse","text":"Text anzeigen","addressPlaceholder":"http://example.com","textPlaceholder":"Text eingeben","targetPlaceholder":"Ziel auswählen","titlePlaceholder":"Geben Sie einen Titel ein","urlPlaceholder":"http://example.com/image.png","captionPlaceholder":"Bildbeschriftung","altPlaceholder":"alternativer Text","widthPlaceholder":"auto","heightPlaceholder":"auto","target":"Öffnen Sie den Link in","linkBlankDescr":"Neues Fenster","linkSelfDescr":"Gleiches Fenster","linkParentDescr":"Übergeordneter Rahmen","linkTopDescr":"Ganzkörper des Fensters","linkCustomDescr":"Benutzerdefinierter Frame-Name","title":"Titel","url":"Sie können auch die URL zu einem Bild angeben","width":"Breite","height":"Höhe","alt":"alternativer Text","caption":"Bildbeschriftung","display":"Anzeige","displayPlaceholder":"Anzeige","displayBlock":"Block","displayInline":"Im Einklang","draggable":"Aktivieren Sie das Ziehen","resizable":"Aktivieren Sie die Größenänderung","browse":"Durchsuche","connectionError":"{{elementType}}: Für das Hochladen von Dateien ist eine Verbindung zum Server erforderlich.","wrongItemIndex":"{{elementType}}: Die Liste der hochgeladenen Dateien enthält keine Datei mit einem solchen Index.","tooLongFileName":"{{elementType}}: Der Dateiname ist zu lang.","totalFiles":"Gesamtzahl der Dateien: ","cancelFile":"Datei abbrechen","dashedborders":"Gestrichelte Grenzen","altrows":"Alternative Zeilen","insertRowBefore":"Zeile vor einfügen","insertRowAfter":"Zeile nach einfügen","deleteRow":"Zeile löschen","insertColumnLeft":"Spalte links einfügen","insertColumnRight":"Spalte rechts einfügen","deleteColumn":"Spalte löschen","alignTop":"Oben ausrichten","alignMiddle":"Mitte ausrichten","alignBottom":"Unten ausrichten","delete":"Löschen","tablerows":"Tabellenzeilen","tablecolumns":"Tabellenspalten","tablevalign":"Vertikale Ausrichtung der Tabellenzelle","tablestyle":"Tischstil","tableheader":"Tabellenüberschrift","buttonLabel":"Benutzerdefinierte Tabelle","pasteLabel":"Wählen Sie die Aktion zum Einfügen des Formats:","cols":"Säulen","rows":"Reihen","alphabet":"abcdefghijklmnopqrstuvwxyz","header":"Header","column":"Säule","plainText":"Klartext","keepFormat":"Format beibehalten","cleanFormat":"Format bereinigen","roleDescription":"Texteditor","iframeTitle":"Der Inhalt des Editors befindet sich in einem eigenen DOM in einem iFrame","toolbarButtonAriaLabel":"Symbolleisten-Umschalttaste","primaryToolbarAriaLabel":"Primäre Symbolleiste","secondaryToolbarAriaLabel":"Sekundäre Symbolleiste","inputAriaLabel":"Text eingeben"}}'></smart-editor>

Set the messages property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.messages = {"it":{"invalidValue":"{{elementType}}: valore {{property}} non valido. {{property}} deve essere di tipo {{typeOne}} o {{typeTwo}}.","incorrectArgument":"{{elementType}}: argomento {{topicName}} non corretto nel metodo {{methodName}}.","permissionsRequired":"{{elementType}}: sono necessarie autorizzazioni per la seguente azione {{actionName}}.","ok":"Ok","cancel":"Annulla","alignLeft":"Allineare a sinistra","alignCenter":"Allinea al centro","alignRight":"Allinea a destra","alignJustify":"Allinea Giustifica","segoeUi":"Segoe UI","arial":"Arial","georgia":"Georgia","impact":"Impact","tahoma":"Tahoma","timesNewRoman":"Times New Roman","verdana":"Verdana","p":"Paragrafo","pre":"Codice","code":"Codice","blockquote":"Quotazione","h1":"Intestazione 1","h2":"Intestazione 2","h3":"Intestazione 3","h4":"Intestazione 4","h5":"Intestazione 5","h6":"Intestazione 6","bold":"Grassetto","italic":"Corsivo","underline":"Sottolineare","strikethrough":"Barrato","orderedlist":"Lista ordinata","unorderedlist":"Lista non ordinata","subscript":"Pedice","superscript":"Apice","alignment":"Allineamenti","fontname":"Nome carattere","fontsize":"Dimensione del font","formats":"Formati","backgroundcolor":"Colore di sfondo","fontcolor":"Colore del carattere","redo":"Rifare","undo":"Disfare","indent":"Rientro","outdent":"Outdent","createlink":"Collegamento ipertestuale","hyperlink":"Collegamento ipertestuale","editlink":"Collegamento ipertestuale","removelink":"Rimuovi collegamento","openlink":"Link aperto","image":"Immagine","table":"Tavolo","lowercase":"Case inferiore","uppercase":"Maiuscolo","print":"Stampa","cut":"Taglio","copy":"Copia","paste":"Incolla","clearformat":"Cancella formato","fullscreen":"A schermo intero","restore":"Ripristina schermo","sourcecode":"Codice sorgente","preview":"Anteprima","splitmode":"Editor diviso","address":"Indirizzo Web","text":"Visualizza testo","addressPlaceholder":"http://example.com","textPlaceholder":"Inserire il testo","targetPlaceholder":"Seleziona Target","titlePlaceholder":"Immettere un titolo","urlPlaceholder":"http://example.com/image.png","captionPlaceholder":"Didascalia","altPlaceholder":"Testo alternativo","widthPlaceholder":"auto","heightPlaceholder":"auto","target":"Apri collegamento in","linkBlankDescr":"Nuova finestra","linkSelfDescr":"Stessa finestra","linkParentDescr":"Frame genitore","linkTopDescr":"Tutto il corpo della finestra","linkCustomDescr":"Nome frame personalizzato","title":"Titolo","url":"Puoi anche fornire l'URL a un'immagine","width":"Larghezza","height":"Altezza","alt":"Testo alternativo","caption":"Didascalia","display":"Schermo","displayPlaceholder":"Schermo","displayBlock":"Bloccare","displayInline":"In linea","draggable":"Abilita il trascinamento","resizable":"Abilita ridimensionamento","browse":"Navigare","connectionError":"{{elementType}}: il caricamento del file richiede la connessione al server.","wrongItemIndex":"{{elementType}}: non è presente alcun file con tale indice nell'elenco dei file caricati.","tooLongFileName":"{{elementType}}: il nome del file è troppo lungo.","totalFiles":"File totali: ","cancelFile":"Annulla file","dashedborders":"Bordi tratteggiati","altrows":"Righe alternative","insertRowBefore":"Inserisci riga prima","insertRowAfter":"Inserisci riga dopo","deleteRow":"Elimina riga","insertColumnLeft":"Inserisci colonna a sinistra","insertColumnRight":"Inserisci colonna a destra","deleteColumn":"Elimina colonna","alignTop":"Allinea in alto","alignMiddle":"Allinea al centro","alignBottom":"Allinea in basso","delete":"Elimina","tablerows":"Righe tabella","tablecolumns":"Colonne della tabella","tablevalign":"Allineamento verticale delle celle della tabella","tablestyle":"Stile tavolo","tableheader":"Intestazione tabella","buttonLabel":"Tabella personalizzata","pasteLabel":"Scegli l'azione di formato Incolla:","cols":"Colonne","rows":"Righe","alphabet":"abcdefghijklmnopqrstuvwxyz","header":"Intestazione","column":"Colonna","plainText":"Testo normale","keepFormat":"Mantieni formato","cleanFormat":"Formato pulito","roleDescription":"Editor di testo","iframeTitle":"Il contenuto dell'editor è racchiuso nel proprio DOM all'interno di un iFrame","toolbarButtonAriaLabel":"Pulsante di attivazione","primaryToolbarAriaLabel":"Barra degli strumenti principale","secondaryToolbarAriaLabel":"Barra degli strumenti secondaria","inputAriaLabel":"Inserire il testo"}};

Get the messages property.

 const editor = document.querySelector('smart-editor');
 let messages = editor.messages;

placeholderstring

Determines the placeholder that will be shown when there's no content inside the Editor.

Default value

""

Example

Set the placeholder property.

 <smart-editor placeholder='Please Enter ...'></smart-editor>

Set the placeholder property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.placeholder = 'Waiting for input...';

Get the placeholder property.

 const editor = document.querySelector('smart-editor');
 let placeholder = editor.placeholder;

sanitizedboolean

Determines whether the value is sanitized from XSS content or not. When enabled scripts and other XSS vulnerabilities are not allowed to exist inside the Editor's as HTML content.

Default value

false

Example

Set the sanitized property.

 <smart-editor sanitized></smart-editor>

Set the sanitized property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.sanitized = false;

Get the sanitized property.

 const editor = document.querySelector('smart-editor');
 let sanitized = editor.sanitized;

showCharCountboolean

Determines whether the char counter is visible or not. When enabled it is displayed in the bottom right corner. If maxCharCount is set and the content characters are equal or more than 70% of the maximum char count the counter is colored in order to warn the user. If the char count is equal or more than 90% the counter is again colored with a different warning color to indicate that the counter is near maximum. When maximum is reached, text input is not allowed.

Default value

false

Example

Set the showCharCount property.

 <smart-editor show-char-count></smart-editor>

Set the showCharCount property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.showCharCount = true;

Get the showCharCount property.

 const editor = document.querySelector('smart-editor');
 let showCharCount = editor.showCharCount;

splitModeRefreshTimeoutnumber

Determines the refresh interval for the Source Code/Preview Panel when Split Mode is enabled.

Default value

100

Example

Set the splitModeRefreshTimeout property.

 <smart-editor split-mode-refresh-timeout='500'></smart-editor>

Set the splitModeRefreshTimeout property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.splitModeRefreshTimeout = 50;

Get the splitModeRefreshTimeout property.

 const editor = document.querySelector('smart-editor');
 let splitModeRefreshTimeout = editor.splitModeRefreshTimeout;

themestring

Determines the theme. Theme defines the look of the element

Default value

""

Example

Set the theme property.

 <smart-editor theme='blue'></smart-editor>

Set the theme property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.theme = 'red';

Get the theme property.

 const editor = document.querySelector('smart-editor');
 let theme = editor.theme;

toolbarItemsstring[] | { name?: string, disabled?: boolean, advanced?: boolean, dataSource?: string[] | object[], inlineToolbarItems?: string[] | ToolbarItem[], editor?: ToolbarItemEditor[], template?: function | string, width?: string | number }[]

Determines the Toolbar items list. Each item can be string pointing to the name of the item or an object that defines a custom item or adds aditional settings to an item. The name of the items are case insensitive. An object definition should contain a name attribute that refers to the name of the item when modifing an existing toolbar item. The name attribute determines the action of the item. If set to 'custom' it is possible to create a custom toolbar item. If name attribute is not set or not valid it is treated as a separator, no a toolbar item. The following items are supported by default by the Editor:

  • SourceCode - shows the HTML/Preview Panel by hiding the input panel. Item type - 'Toggle button'.
  • SplitMode - shows both input and HTML/Preview Panel by splitting the Editor content in two sections. Item type - 'Toggle button'
  • FullScreen - fits the viewport with the Editor by expanding it over the page content. Item type - 'Toggle button'.
  • Alignment - aligns the selected content. Item type - 'Drop down'.
  • FontName - changes the font family of the selected content. Item type - 'drop-down'.
  • FontSize - changes the font size of the selected content. Item type - 'drop-down'.
  • Formats - changes the format of the current selection. Itme type - 'drop-down'.
  • TableRows - allows to insert/remove a row into a selected table element. Item type - 'drop-down'.
  • TableColumns - allows to insert/remove a column into a selected table element. Itme type - 'drop-down'.
  • TableVAlign - sets the vertical alignment of a selected table cell. Item type - 'drop-down'.
  • TableStyle - sets additional styling to a selected table inside the Editor. Item type - 'drop-down'.
  • BackgroundColor - changes the background color of the current selection. Item type - 'color-input'.
  • FontColor - changes the font color of the current selection. Item type = 'color-input'.
  • Bold - sets the currently selected text as bold or not. Item type - 'button'.
  • Italic - sets the currently selected text as italic. Item type - 'button'.
  • Underline - sets the currently selected text as underlined. Itme type - 'button'.
  • Strikethrough - set the currently selected text as strikethrough. Item type - 'button'.
  • Delete - deletes the current selection. Item type - 'button'.
  • Undo - undoes the last operation. Item type - 'button'.
  • Redo - redoes the previous operation. Item type - 'button'.
  • Indent - indents the current selection once. Item type - 'button'.
  • Outdent - outdents the current selection once. Item type - 'button'.
  • OpenLink - triggers a hyperlink. Item type - 'button'.
  • EditLink - creates/edits the selected hyperlink. Item type - 'button'.
  • CreateLink - creates/edits the selected hyperlink. Item type - 'button'.
  • RemoveLink - removes the currently selected hyperlink. Item type - 'button'.
  • Hyperlink - same as createLink, triggers a Dialog Window for link creation. Item type - 'button'.
  • Cut - Cuts the currently selected text. Item type - 'button'.
  • Copy - copies the currently selected text. Item type - 'button'
  • Paste - pastes the currenly copied/cut text from the Clipboard. Item type = 'button' or 'drop-down' when advanced attribute is set to 'true'.
  • Image - triggers a Dialog Window to insert/edit an image. Item type - 'button'.
  • LowerCase - changes the current selection to lower case. Item type - 'button'.
  • UpperCase - changes the current selection to upper case. Item type - 'button'.
  • Print - opens the browser print preview window. Item type - 'button'.
  • Caption - insert/remove a caption when a table is selected. Item type - 'button'.
  • ClearFormat - removes the formatting of the currntly selected text. Item type - 'button'.
  • Table - triggers a Dialog Window to insert a table. Item type - 'button'.
  • TableHeader - insert/remove a header row to the currently selected table. Item type - 'button'.
  • OrderedList - insert/remove an order list. Item type = 'button'.
  • UnorderedList - insert/remove an unordered list. Item type - 'button'.
  • Subscript - changes the currently selected text to subscript. Item type - 'button'.
  • Superscript - changes the currently selected text to superscript. Item type - 'button'.

The inlineToolbarItems attribute is applicable only to the following items: 'table', 'image', 'hyperlink'. It accepts the same type of value as toolbarItems property but the toolbar items will be placed insinde the Inline Toolbar instead.

Properties

namestring | null

The unique name of the toolbar item. The list of all possible names is available in the description above.

Default value

""

Get the name property.

 const editor = document.querySelector('smart-editor');
 let name = editor.toolbarItems[0].name;

disabledboolean | null

Determines whethet the item is disabled or not.

Default value

false

Get the disabled property.

 const editor = document.querySelector('smart-editor');
 let disabled = editor.toolbarItems[0].disabled;

advancedboolean | null

Applicable only to item 'paste'. Transforms the type of the Paste toolbar item to drop down list with paste format options.

Default value

false

Get the advanced property.

 const editor = document.querySelector('smart-editor');
 let advanced = editor.toolbarItems[0].advanced;

dataSourcestring[] | object[] | null

Allows to set a different dataSource for the toolbar items of type 'drop-down' or 'color-input.

Get the dataSource property.

 const editor = document.querySelector('smart-editor');
 let dataSource = editor.toolbarItems[0].dataSource;

inlineToolbarItemsstring[] | { name?: string, disabled?: boolean, advanced?: boolean, dataSource?: string[] : object[], template?: function | string, width?: string | number }[]

Defines the list of toolbar items for the Inline Toolbar. Accept the same values as toolbarItems property.

Get the inlineToolbarItems property.

 const editor = document.querySelector('smart-editor');
 let inlineToolbarItems = editor.toolbarItems[0].inlineToolbarItems;

editor{ address?: string, target?: string, text?: string, title?: string, file?: File, url?: string, alt?: string, width?: string | number, height?: string | number, caption?: string, alignment?: string, display?: string, draggable?: boolean, resizable?: boolean, rows?: number, cols?: number, tableheader?: boolean, altrows?: boolean, dashedborders?: boolean } | null

Allows to set predefined values for the Dialog Window of the following toolbar items: 'table', 'image', 'hyperlink'.

Properties

addressstring | null

Allows to preset the value for the hyperlink address field in the Dialog Window.

Default value

""

Get the address property.

 const editor = document.querySelector('smart-editor');
 let address = editor.toolbarItems[0].address;

targetstring | null

Allows to preset the value for the hyperlink target field in the Dialog Window.

Default value

""

Get the target property.

 const editor = document.querySelector('smart-editor');
 let target = editor.toolbarItems[0].target;

textstring | null

Allows to preset the value for the hyperlink text field in the Dialog Window.

Default value

""

Get the text property.

 const editor = document.querySelector('smart-editor');
 let text = editor.toolbarItems[0].text;

titlestring | null

Allows to preset the value for the hyperlink/image title field in the Dialog Window.

Default value

""

Get the title property.

 const editor = document.querySelector('smart-editor');
 let title = editor.toolbarItems[0].title;

fileobject

Allows to preset the value for the image file uploader in the Dialog Window.

Get the file property.

 const editor = document.querySelector('smart-editor');
 let file = editor.toolbarItems[0].file;

altstring | null

Allows to preset the value for the image alt field in the Dialog Window.

Default value

""

Get the alt property.

 const editor = document.querySelector('smart-editor');
 let alt = editor.toolbarItems[0].alt;

urlstring | null

Allows to preset the value for the image url field in the Dialog Window.

Default value

""

Get the url property.

 const editor = document.querySelector('smart-editor');
 let url = editor.toolbarItems[0].url;

widthstring | number

Allows to preset the value for the image/table width field in the Dialog Window.

Default value

""

Get the width property.

 const editor = document.querySelector('smart-editor');
 let width = editor.toolbarItems[0].width;

heightstring | number

Allows to preset the value for the image/table height field in the Dialog Window.

Default value

""

Get the height property.

 const editor = document.querySelector('smart-editor');
 let height = editor.toolbarItems[0].height;

captionstring | null

Allows to preset the value for the image caption field in the Dialog Window.

Default value

""

Get the caption property.

 const editor = document.querySelector('smart-editor');
 let caption = editor.toolbarItems[0].caption;

alignmentstring | null

Allows to preset the value for the image alignment field in the Dialog Window.

Default value

""

Get the alignment property.

 const editor = document.querySelector('smart-editor');
 let alignment = editor.toolbarItems[0].alignment;

displaystring | null

Allows to preset the value for the image display field in the Dialog Window.

Default value

""

Get the display property.

 const editor = document.querySelector('smart-editor');
 let display = editor.toolbarItems[0].display;

draggableboolean | null

Allows to preset the value for the image/table draggable field in the Dialog Window.

Default value

false

Get the draggable property.

 const editor = document.querySelector('smart-editor');
 let draggable = editor.toolbarItems[0].draggable;

resizableboolean | null

Allows to preset the value for the image/table resizable field in the Dialog Window.

Default value

false

Get the resizable property.

 const editor = document.querySelector('smart-editor');
 let resizable = editor.toolbarItems[0].resizable;

colsnumber | string | null

Allows to preset the value for the table cols field in the Dialog Window.

Default value

""

Get the cols property.

 const editor = document.querySelector('smart-editor');
 let cols = editor.toolbarItems[0].cols;

rowsnumber | string | null

Allows to preset the value for the table rows field in the Dialog Window.

Default value

""

Get the rows property.

 const editor = document.querySelector('smart-editor');
 let rows = editor.toolbarItems[0].rows;

tableheaderboolean | null

Allows to preset the value for the table header field in the Dialog Window.

Default value

false

Get the tableheader property.

 const editor = document.querySelector('smart-editor');
 let tableheader = editor.toolbarItems[0].tableheader;

altrowsboolean | null

Allows to preset the value for the table altrows field in the Dialog Window.

Default value

false

Get the altrows property.

 const editor = document.querySelector('smart-editor');
 let altrows = editor.toolbarItems[0].altrows;

dashedbordersboolean | null

Allows to preset the value for the table dashedborders field in the Dialog Window.

Default value

false

Get the dashedborders property.

 const editor = document.querySelector('smart-editor');
 let dashedborders = editor.toolbarItems[0].dashedborders;

Get the editor property.

 const editor = document.querySelector('smart-editor');
 let editor = editor.toolbarItems[0].editor.editor;

templatefunction | string | null

Allows to set a template for a custom Toolbar item when the name attribute is set to 'custom'.

Get the template property.

 const editor = document.querySelector('smart-editor');
 let template = editor.toolbarItems[0].editor.template;

widthnumber | string | null

Determines the width of the toolbar item.

Default value

""

Get the width property.

 const editor = document.querySelector('smart-editor');
 let width = editor.toolbarItems[0].editor.width;

Example

Set the toolbarItems property.

 <smart-editor toolbar-items='[ "bold",  "italic", "underline"]'></smart-editor>

Set the toolbarItems property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.toolbarItems = [ "hyperlink", "image", "table"];

Get the toolbarItems property.

 const editor = document.querySelector('smart-editor');
 let toolbarItems = editor.toolbarItems;

toolbarViewMode"toggle" | "multiRow" | "scroll"

Determines the format of the content that will be pasted inside the Editor.

Default value

"toggle"

Example

Set the toolbarViewMode property.

 <smart-editor toolbar-view-mode='multiRow'></smart-editor>

Set the toolbarViewMode property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.toolbarViewMode = 'scroll';

Get the toolbarViewMode property.

 const editor = document.querySelector('smart-editor');
 let toolbarViewMode = editor.toolbarViewMode;

toolbarStickyboolean

Sticks the Toolbar to the top of the window and stays there while scrolling.

Default value

false

Example

Set the toolbarSticky property.

 <smart-editor toolbar-sticky></smart-editor>

Set the toolbarSticky property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.toolbarSticky = false;

Get the toolbarSticky property.

 const editor = document.querySelector('smart-editor');
 let toolbarSticky = editor.toolbarSticky;

unfocusableboolean

If is set to true, the element cannot be focused.

Default value

false

Example

Set the unfocusable property.

 <smart-editor unfocusable></smart-editor>

Set the unfocusable property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.unfocusable = false;

Get the unfocusable property.

 const editor = document.querySelector('smart-editor');
 let unfocusable = editor.unfocusable;

valuestring

Sets or gets the value of the Editor.

Default value

""""

Example

Set the value property.

 <smart-editor value='

Value

'></smart-editor>

Set the value property by using the HTML Element's instance.

 const editor = document.querySelector('smart-editor');
 editor.value = '**Markdown**';

Get the value property.

 const editor = document.querySelector('smart-editor');
 let value = editor.value;

Events

changeCustomEvent

This event is triggered on blur if the content is changed.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onChange

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of change event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('change', function (event) {
	// event handling code goes here.
})

actionStartCustomEvent

This event is triggered before a Toolbar action is started. The event can be canceled via event.preventDefault().

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onActionStart

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of actionStart event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('actionStart', function (event) {
	// event handling code goes here.
})

actionEndCustomEvent

This event is triggered when a Toolbar action has ended.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onActionEnd

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of actionEnd event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('actionEnd', function (event) {
	// event handling code goes here.
})

resizeStartCustomEvent

This event is triggered when an image/table resizing has started.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onResizeStart

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of resizeStart event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('resizeStart', function (event) {
	// event handling code goes here.
})

resizeEndCustomEvent

This event is triggered when an image/table resizing has ended.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onResizeEnd

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of resizeEnd event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('resizeEnd', function (event) {
	// event handling code goes here.
})

inlineToolbarOpenCustomEvent

This event is triggered when the inline Toolbar is opened.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onInlineToolbarOpen

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of inlineToolbarOpen event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('inlineToolbarOpen', function (event) {
	// event handling code goes here.
})

inlineToolbarCloseCustomEvent

This event is triggered when the inline Toolbar is closed.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onInlineToolbarClose

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of inlineToolbarClose event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('inlineToolbarClose', function (event) {
	// event handling code goes here.
})

dropDownToolbarOpenCustomEvent

This event is triggered when the Drop Down Toolbar is opened.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onDropDownToolbarOpen

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of dropDownToolbarOpen event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('dropDownToolbarOpen', function (event) {
	// event handling code goes here.
})

dropDownToolbarCloseCustomEvent

This event is triggered when the Drop Down Toolbar is closed.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onDropDownToolbarClose

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of dropDownToolbarClose event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('dropDownToolbarClose', function (event) {
	// event handling code goes here.
})

dialogOpenCustomEvent

This event is triggered the Dialog Window is opened.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onDialogOpen

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of dialogOpen event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('dialogOpen', function (event) {
	// event handling code goes here.
})

dialogOpeningCustomEvent

This event is triggered before the Dialog Window is opened. The event can be prevented via event.preventDefault().

  • Bubbles Yes
  • Cancelable Yes
  • Interface CustomEvent
  • Event handler property onDialogOpening

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of dialogOpening event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('dialogOpening', function (event) {
	// event handling code goes here.
})

dialogCloseCustomEvent

This event is triggered when the Dialog Window is closed.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onDialogClose

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of dialogClose event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('dialogClose', function (event) {
	// event handling code goes here.
})

dialogClosingCustomEvent

This event is triggered before the Dialog Window is closed. The event can be prevented via event.preventDefault().

  • Bubbles Yes
  • Cancelable Yes
  • Interface CustomEvent
  • Event handler property onDialogClosing

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of dialogClosing event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('dialogClosing', function (event) {
	// event handling code goes here.
})

imageUploadSuccessCustomEvent

This event is triggered when the uploading of an image is successful.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onImageUploadSuccess

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of imageUploadSuccess event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('imageUploadSuccess', function (event) {
	// event handling code goes here.
})

imageUploadFailedCustomEvent

This event is triggered when the uploading of an image is unsuccessful.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onImageUploadFailed

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of imageUploadFailed event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('imageUploadFailed', function (event) {
	// event handling code goes here.
})

toobarItemClickCustomEvent

This event is triggered when a Toolbar item is clicked.

  • Bubbles Yes
  • Cancelable No
  • Interface CustomEvent
  • Event handler property onToobarItemClick

Arguments

evCustomEvent

Methods

isDefaultPrevented

Returns true if the event was prevented by any of its subscribers.

Returns

boolean true if the default action was prevented. Otherwise, returns false.

preventDefault

The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.

stopPropagation

The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.

Example

Set up the event handler of toobarItemClick event.

const editor = document.querySelector('smart-editor');
editor.addEventListener('toobarItemClick', function (event) {
	// event handling code goes here.
})

Methods

blur(): void

Blurs the content of the Editor.


Invoke the blur method.

const editor = document.querySelector('smart-editor');
editor.blur();

clearContent(): void

Clears the content of the Editor.


Invoke the clearContent method.

const editor = document.querySelector('smart-editor');
editor.clearContent();

collapseToolbar(): void

Collapse the Toolbar if the toolbarViewMode is set to 'toggle'.


Invoke the collapseToolbar method.

const editor = document.querySelector('smart-editor');
editor.collapseToolbar();

disableToolbarItem( itemName: string): void

Disables a Toolbar item.

Arguments

itemNamestring

The name of the toolbar item to disable.


Invoke the disableToolbarItem method.

const editor = document.querySelector('smart-editor');
editor.disableToolbarItem("bold","formats");

expandToolbar(): void

Expand the Toolbar if the toolbarViewMode is set to 'toggle'.


Invoke the expandToolbar method.

const editor = document.querySelector('smart-editor');
editor.expandToolbar();

enableToolbarItem( itemName: string): void

Enables a previously disabled Toolbar item.

Arguments

itemNamestring

The name of the toolbar item to enable.


Invoke the enableToolbarItem method.

const editor = document.querySelector('smart-editor');
editor.enableToolbarItem("bold","formats");

executeCommand( commandName: string, value?: string | number): boolean

Executes a command via the native execCommand method. The method returns true or false depending on whether the execution was successful or not.

Arguments

commandNamestring

The name of the command to execute.

value?string | number

The value for the command. Some commands require a value to be passed, others do not.

Returnsboolean

Invoke the executeCommand method.

const editor = document.querySelector('smart-editor');
const result = editor.executeCommand("fontSize, 17","formatBlock, 'code'");

focus(): void

Focuses the content of the Editor.


Invoke the focus method.

const editor = document.querySelector('smart-editor');
editor.focus();

getCharCount(): number

Returns the number of characters inside the Editor's content.

Returnsnumber

Invoke the getCharCount method.

const editor = document.querySelector('smart-editor');
const result = editor.getCharCount();

getSelectionRange(): Range | object

Returns the current selection range. By default the result is an object of type Range, but if the editMode property is set to 'markdown' the returned value is an object indicating the start/end indexes of the current selection.

ReturnsRange | object

Invoke the getSelectionRange method.

const editor = document.querySelector('smart-editor');
const result = editor.getSelectionRange();

selectAll(): void

Selects the text inside Editor's content.


Invoke the selectAll method.

const editor = document.querySelector('smart-editor');
editor.selectAll();

getHTML(): string

Returns the content of the Editor as HTML. When editMode is set to 'markdown' the markdown is parsed and returned as HTML.

Returnsstring

Invoke the getHTML method.

const editor = document.querySelector('smart-editor');
const result = editor.getHTML();

getText(): string

Returns the content of the Editor as text.

Returnsstring

Invoke the getText method.

const editor = document.querySelector('smart-editor');
const result = editor.getText();

getMarkdown(): string

Applicable only when editMode is set to 'markdown'. Returns the Editor's content as markdown.

Returnsstring

Invoke the getMarkdown method.

const editor = document.querySelector('smart-editor');
const result = editor.getMarkdown();

selectRange( node: HTMLElement | Node, startIndex?: number, endIndex?: number): void

Selects a range of text inside the Editor.

Arguments

nodeHTMLElement | Node

The node to be selected. It can be a text node or an HTML element.

startIndex?number

The start index of the node to select from. If not provided all node contents are selected.

endIndex?number

The end index of the node to select to. If not provided all node contents are selected.


Invoke the selectRange method.

const editor = document.querySelector('smart-editor');
editor.selectRange("textNode, 2, 10","paragraph");

clearState(): void

Clears the local storage from previously stored states of the Editor with the current id.


Invoke the clearState method.

const editor = document.querySelector('smart-editor');
editor.clearState();

saveState(): void

Saves the current state of the Editor to local storage. Requires an id to be set to the Editor.


Invoke the saveState method.

const editor = document.querySelector('smart-editor');
editor.saveState();

loadState(): void

Loads the last stored state of the Editor from local storage. Requires an id to be set to the Editor.


Invoke the loadState method.

const editor = document.querySelector('smart-editor');
editor.loadState();

splitMode( value?: boolean): void

Sets Editor into Split Mode. In split mode the HTML/Markdown editor and SourceCode/Preview panels are visible.

Arguments

value?boolean

Determines whether to enter or leave split mode. By default the argument is not passed and the mode is toggled.


Invoke the splitMode method.

const editor = document.querySelector('smart-editor');
editor.splitMode();

previewMode( value?: boolean): void

Sets Editor into SourceCode/Preview Mode. In this mode the HTML view panel is displayed.

Arguments

value?boolean

Determines whether to enter or leave split mode. By default the argument is not passed and the mode is toggled.


Invoke the previewMode method.

const editor = document.querySelector('smart-editor');
editor.previewMode();

fullScreenMode( value?: boolean): void

Sets Editor into Full Screen Mode. If enabled the Editor is positioned above the page content and fills the screen.

Arguments

value?boolean

Determines whether to enter or leave split mode. By default the argument is not passed and the mode is toggled.


Invoke the fullScreenMode method.

const editor = document.querySelector('smart-editor');
editor.fullScreenMode();

exportData( dataFormat: string, callback?: any): void

Exports the content of the Editor in the desired format. The currently supported formats are: HTML, Markdown.

Arguments

dataFormatstring

The expected file format.

callback?any

A callback that is executed before the data is exported. Allows to modify the output.


Invoke the exportData method.

const editor = document.querySelector('smart-editor');
editor.exportData();

print(): void

Opens the Print Preview Panel of the Browser to print Editor's content.


Invoke the print method.

const editor = document.querySelector('smart-editor');
editor.print();

CSS Variables

--smart-editor-default-widthvar()

Default value

"100%"

Default smartEditor width.

--smart-editor-default-heightvar()

Default value

"600px"

Default smartEditor height.

--smart-editor-input-min-heightvar()

Default value

"100px"

smartEditor content min height.

--smart-editor-paddingvar()

Default value

"15px"

smartEditor content padding

--smart-editor-toolbar-item-marginvar()

Default value

"5px"

smartEditor toolbar item margin.

--smart-editor-toolbar-button-widthvar()

Default value

"30px"

smartEditor toolbar item button width.

--smart-editor-toolbar-delimiter-widthvar()

Default value

"5px"

smartEditor toolbar item delimiter width.

--smart-editor-toolbar-drop-down-width-largevar()

Default value

"100px"

smartEditor large drop down toolbar items width. Used for the following toobar items: 'fontName', 'formats'.

--smart-editor-toolbar-drop-down-width-smallvar()

Default value

"65px"

smartEditor small drop down toolbar items width. Used for the every toobar item of type 'color-input' and 'drop-down', except the following: 'fontName', 'formats'.

--smart-editor-window-header-heightvar()

Default value

"35px"

smartEditor Dialog Window header height.

Default value

"50px"

smartEditor Dialog Window footer height.

--smart-editor-inline-toolbar-max-widthvar()

Default value

"80vw"

smartEditor Inline Toolbar maximum width.

--smart-editor-table-column-widthvar()

Default value

"initial"

smartEditor default tables column width.

--smart-editor-table-cell-min-heightvar()

Default value

"20px"

smartEditor default tables cell min height.

--smart-editor-table-cell-min-widthvar()

Default value

"20px"

smartEditor default tables cell min width.

--smart-editor-chart-counter-offsetvar()

Default value

"30px"

smartEditor char counter default offset from the borders of the element.

--smart-editor-toolbar-item-heightvar()

Default value

"30px"

smartEditor toolbar item height.

--smart-editor-toolbar-item-border-radiusvar()

Default value

"4px"

smartEditor toolbar item border radius.

--smart-editor-toolbar-heightvar()

Default value

"calc(var(--smart-editor-toolbar-item-height) + 2 * var(--smart-editor-toolbar-padding))"

smartEditor toolbar height.