LeechCraft 0.6.70-17335-ge406ffdcaf
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
iadvancedhtmleditor.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <functional>
12#include <QPair>
13#include <QList>
14#include <QRegularExpression>
15
16class QDomElement;
17
36class Q_DECL_EXPORT IAdvancedHTMLEditor
37{
38public:
40
41 typedef QPair<QRegularExpression, QString> Replacement_t;
43
46 struct CustomTag
47 {
50 QString TagName_;
51
52 enum class TagType
53 {
57 };
58
60
81 std::function<void (QDomElement&)> ToKnown_;
82
113 std::function<bool (QDomElement&)> FromKnown_;
114 };
116
124 virtual void InsertHTML (const QString& html) = 0;
125
135 virtual void SetCustomTags (const CustomTags_t& tags) = 0;
136
154 virtual QAction* AddInlineTagInserter (const QString& tagName, const QVariantMap& params) = 0;
155
160 virtual void ExecJS (const QString& js) = 0;
161};
162
163Q_DECLARE_INTERFACE (IAdvancedHTMLEditor, "org.Deviant.LeechCraft.IAdvancedHTMLEditor/1.0")
Interface for HTML/WYSIWYG editors with some advanced functionality.
virtual void InsertHTML(const QString &html)=0
Inserts the given HTML at the current cursor position.
virtual QAction * AddInlineTagInserter(const QString &tagName, const QVariantMap &params)=0
Adds a custom action to wrap selected text into given tag.
QPair< QRegularExpression, QString > Replacement_t
virtual void ExecJS(const QString &js)=0
Executes the given js in the context of the content.
QList< Replacement_t > Replacements_t
QList< CustomTag > CustomTags_t
virtual void SetCustomTags(const CustomTags_t &tags)=0
Adds support for custom tags not present in HTML standard.
Describes a single custom tag.
std::function< bool(QDomElement &)> FromKnown_
The converter of an instance of the tag from HTML.
QString TagName_
The name of the custom tag, like lj.
std::function< void(QDomElement &)> ToKnown_
The converter of an instance of the tag to HTML.