TextEditor: Use new setup pattern for markdown and json editor

And remove the now-empty plugin pimpl.

Change-Id: Ie00b747a4a41bc6efc84ea43db81a71e8364df3d
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-01-26 16:01:31 +01:00
parent d2db92e248
commit d4635d4389
5 changed files with 52 additions and 56 deletions

View File

@@ -8,13 +8,18 @@
#include "texteditortr.h"
#include <aggregation/aggregate.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/coreplugintr.h>
#include <coreplugin/editormanager/ieditorfactory.h>
#include <coreplugin/icore.h>
#include <coreplugin/minisplitter.h>
#include <texteditor/texteditoractionhandler.h>
#include <utils/ranges.h>
#include <utils/parameteraction.h>
#include <utils/qtcsettings.h>
#include <utils/qtcsettings.h>
#include <utils/stringutils.h>
@@ -491,6 +496,22 @@ private:
std::optional<QPoint> m_previewRestoreScrollPosition;
};
class MarkdownEditorFactory final : public IEditorFactory
{
public:
MarkdownEditorFactory();
private:
TextEditorActionHandler m_actionHandler;
Action m_emphasisAction;
Action m_strongAction;
Action m_inlineCodeAction;
Action m_linkAction;
Action m_toggleEditorAction;
Action m_togglePreviewAction;
Action m_swapAction;
};
MarkdownEditorFactory::MarkdownEditorFactory()
: m_actionHandler(MARKDOWNVIEWER_ID,
MARKDOWNVIEWER_TEXT_CONTEXT,
@@ -663,6 +684,11 @@ void MarkdownEditorWidget::findLinkAt(const QTextCursor &cursor,
}
}
void setupMarkdownEditor()
{
static MarkdownEditorFactory theMarkdownEditorFactory;
}
} // namespace TextEditor::Internal
#include "markdowneditor.moc"