Bug 392356 - JJ: Allow pasting rich text in the text tool editor
Summary: JJ: Allow pasting rich text in the text tool editor
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tool/Text (show other bugs)
Version: 4.0
Platform: Microsoft Windows Microsoft Windows
: NOR wishlist
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2018-03-26 09:42 UTC by Philippe Lhoste
Modified: 2018-10-11 07:50 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Lhoste 2018-03-26 09:42:57 UTC
I am starting to use the new text tool to letter comics.
We need to have consistency across a page, with one, perhaps two (rarely more) fonts (family, size, etc.).
Perhaps someday we will have a way to save (tag?) a predefined set of choices.
Meanwhile, I have two workarounds:
- Copy the generated SVG to some place, so that I can paste it back in the tool. Good idea to expose the source, BTW.
- And include a text sample in the page model, so that I can copy & paste it where I need it, and edit it. (BTW, a shortcut to duplicate a vector shape, including text, would be nice.)

When I edit it, I can do a select all (Ctrl+A) and type the new text, it will keep the settings.
But if I paste a pure plain text instead, it reverts to MS Shell Dlg 2 font with default size, etc.
Pure plain text: in clipboard inspector, there are only UNICODE TEXT, LOCALE, TEXT and OEM TEXT tags, no HTML Format nor Rich Text Format or similar rich text paste format. (Tested, you don't support the latter, I won't blame you...)

There is a simple workaround: if I select all but the first or last character, I can paste while preserving the formatting, then I delete the extra char.

Side note (probably not worth a bug of its own): the SVG source editor reacts strangely to Ctrl+mouse wheel: it decreases size when scrolling forward, which is the reverse of the behavior of all other softwares (eg. browsers).
Another side issue: I don't know if that's the expected behavior, but I have to triple click on the text with the text tool to open the text editing window. Would expect a single click, or at least a double one.
Comment 1 Halla Rempt 2018-03-28 12:09:32 UTC
QTextEdit doesn't support pasting rich text (html or rtf) natively. It's possible to implement that by overriding the copy and paste functions and getting at the mimedata directly. This isn't a complex job, and would make a good starting point for someone who wants to hack on krita.

As for your "side note": please do not mix two or more issues in one report. It makes triaging next to impossible.
Comment 2 Philippe Lhoste 2018-03-30 13:27:05 UTC
I guess I put too much mixed information in my reports, sorry for that.

The essence of the bug is that if we paste plain text after a select all of an existing text with one style (particularly font-family), I want the new text to keep the same text attributes.
This allows to have a preset text (in a template, for example) to be copied and replaced while keeping style consistent.
Comment 3 Dmitry Kazakov 2018-10-11 07:50:10 UTC
Git commit ee24a14ddef66d3280101603065fdef05c419cee by Dmitry Kazakov, on behalf of Mehmet Salih Çalışkan.
Committed on 11/10/2018 at 07:49.
Pushed by dkazakov into branch 'master'.

Paste plain text as selected text style on SVG text tool

Summary:
Paste plain text as selected text style, although all text selected on rich text window on SVG text tool.

{F6319395}
{F6319396}

Reviewers: #krita, dkazakov

Reviewed By: #krita, dkazakov

Subscribers: dkazakov, #krita

Tags: #krita

Differential Revision: https://phabricator.kde.org/D16119

M  +1    -0    plugins/tools/svgtexttool/CMakeLists.txt
A  +17   -0    plugins/tools/svgtexttool/SvgRichTextCtrl.cpp     [License: UNKNOWN]  *
A  +15   -0    plugins/tools/svgtexttool/SvgRichTextCtrl.h     [License: UNKNOWN]  *
M  +9    -2    plugins/tools/svgtexttool/WdgSvgTextEditor.ui

The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


https://commits.kde.org/krita/ee24a14ddef66d3280101603065fdef05c419cee