resolved html pasting issues from 3rd party rich text editor

preferencesAboutTextFull
Didier Clerc 12 years ago
parent 712bd5238c
commit 81507a3b27
  1. 6
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 6
      src/core/core.pri
  3. 3
      src/domain/UBGraphicsScene.cpp

@ -62,6 +62,7 @@
#include "core/UBSetting.h"
#include "core/UBPersistenceManager.h"
#include "core/UBApplication.h"
#include "core/UBTextTools.h"
#include "document/UBDocumentContainer.h"
@ -301,7 +302,7 @@ QUuid UBSvgSubsetAdaptor::sceneUuid(UBDocumentProxy* proxy, const int pageIndex)
UBGraphicsScene* UBSvgSubsetAdaptor::loadScene(UBDocumentProxy* proxy, const QByteArray& pArray)
{
UBSvgSubsetReader reader(proxy, pArray);
UBSvgSubsetReader reader(proxy, UBTextTools::cleanHtmlCData(QString(pArray)).toAscii());
return reader.loadScene();
}
@ -2457,7 +2458,8 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::textItemToSvg(UBGraphicsTextItem* it
// Note: don't use mXmlWriter.writeCDATA(htmlString); because it doesn't escape characters sequences correctly.
// Texts copied from other programs like Open-Office can truncate the svg file.
mXmlWriter.writeCharacters(item->toHtml());
//mXmlWriter.writeCharacters(item->toHtml());
mXmlWriter.writeCharacters(UBTextTools::cleanHtmlCData(item->toHtml()));
mXmlWriter.writeEndElement(); //itemTextContent
mXmlWriter.writeEndElement(); //foreignObject

@ -13,7 +13,8 @@ HEADERS += src/core/UB.h \
src/core/UBApplicationController.h \
src/core/UBDownloadManager.h \
src/core/UBDownloadThread.h \
src/core/UBOpenSankoreImporter.h
src/core/UBOpenSankoreImporter.h \
src/core/UBTextTools.h
SOURCES += src/core/main.cpp \
src/core/UBApplication.cpp \
@ -29,6 +30,7 @@ SOURCES += src/core/main.cpp \
src/core/UBApplicationController.cpp \
src/core/UBDownloadManager.cpp \
src/core/UBDownloadThread.cpp \
src/core/UBOpenSankoreImporter.cpp
src/core/UBOpenSankoreImporter.cpp \
src/core/UBTextTools.cpp

@ -36,6 +36,7 @@
#include "core/UBApplicationController.h"
#include "core/UBDisplayManager.h"
#include "core/UBPersistenceManager.h"
#include "core/UBTextTools.h"
#include "gui/UBMagnifer.h"
#include "gui/UBMainWindow.h"
@ -1629,7 +1630,7 @@ UBGraphicsTextItem *UBGraphicsScene::addTextHtml(const QString &pString, const Q
{
UBGraphicsTextItem *textItem = new UBGraphicsTextItem();
textItem->setPlainText("");
textItem->setHtml(pString);
textItem->setHtml(UBTextTools::cleanHtml(pString));
addItem(textItem);
textItem->show();

Loading…
Cancel
Save