LeechCraft  %{LEECHCRAFT_VERSION}
Modular cross-platform feature rich live environment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IAdvancedHTMLEditor Class Referenceabstract

Interface for HTML/WYSIWYG editors with some advanced functionality. More...

#include "itexteditor.h"

Public Types

typedef QPair< QRegExp, QString > Replacement_t
 
typedef QList< Replacement_tReplacements_t
 

Public Member Functions

virtual ~IAdvancedHTMLEditor ()
 
virtual void InsertHTML (const QString &html)=0
 Inserts the given HTML at the current cursor position. More...
 
virtual void SetTagsMappings (const Replacements_t &rich2html, const Replacements_t &html2rich)=0
 Sets tags mapping for this editor widget. More...
 
virtual void ExecJS (const QString &js)=0
 Executes the given js in the context of the content. More...
 

Detailed Description

Interface for HTML/WYSIWYG editors with some advanced functionality.

Tag mappings

It is sometimes desirable to add support for custom tags not defined in HTML standards, like LJ's user tags. It is possible to define such custom tags by the means of tag mappings, each tag mapping being a pair of QRegExp and QString, which are fed to QString::replace(). The QString can refer to the expressions captured by the QRegExp effectively adding support for custom tag parameters (refer to QString::replace() documentation for more information).

There are two lists comprising tag mappings, first being a translation from the view to source (that would translate an LJ user tag into appropriate spans, imgs and other tags) and the other being the the reverse translation (that would turn that stuff back into an LJ user tag). These lists are passed to the SetTagsMappings() function, the first list called html2rich and the second called rich2html.

Definition at line 194 of file itexteditor.h.

Member Typedef Documentation

typedef QPair<QRegExp, QString> IAdvancedHTMLEditor::Replacement_t

Definition at line 199 of file itexteditor.h.

Definition at line 200 of file itexteditor.h.

Constructor & Destructor Documentation

virtual IAdvancedHTMLEditor::~IAdvancedHTMLEditor ( )
inlinevirtual

Definition at line 197 of file itexteditor.h.

Member Function Documentation

virtual void IAdvancedHTMLEditor::ExecJS ( const QString &  js)
pure virtual

Executes the given js in the context of the content.

Parameters
[in]jsThe JavaScript code to execute.
virtual void IAdvancedHTMLEditor::InsertHTML ( const QString &  html)
pure virtual

Inserts the given HTML at the current cursor position.

This function is somewhat analogous to DOM's

execCommand("insertHTML", ...)

.

Parameters
[in]htmlThe HTML to insert.
virtual void IAdvancedHTMLEditor::SetTagsMappings ( const Replacements_t rich2html,
const Replacements_t html2rich 
)
pure virtual

Sets tags mapping for this editor widget.

This function should be set before ITextEditor::SetContents().

See the IAdvancedHTMLEditor class reference for more information about tags mappings.

Parameters
[in]rich2htmlMappings for view -> source view conversion.
[in]html2richMappings for source view -> view conversion.

The documentation for this class was generated from the following file: