SetDocumentBodyCommand.h header

#include <ew/core/SetDocumentBodyCommand.h>

Namespace ew::core

SetDocumentBodyCommand class

class ew::core::SetDocumentBodyCommand

Command that replaces a document's body text (the Markdown that is its prose). It exists so a programmatic rewrite of the body – notably re-pointing inline object links (ewriter://object/ URLs) when one entity is merged into another – is a single, undoable edit; the live editor keeps its own in-widget undo for typing. Undo restores the previous body and redo re-applies the new one.

Members

ew::core::SetDocumentBodyCommand::SetDocumentBodyCommand(Document &document, QString body)

Creates a command that sets document's body to body when applied.

ew::core::SetDocumentBodyCommand::~SetDocumentBodyCommand() override

Destroys the command.

void ew::core::SetDocumentBodyCommand::apply() override

Records the document's current body and applies the new one.

void ew::core::SetDocumentBodyCommand::undo() override

Restores the previous body.

QString ew::core::SetDocumentBodyCommand::description() const override

Returns a short description for the undo/redo UI.