pklaschka/lorem-ipsum-plugin

Create placeholder texts from rectangles

pklaschka opened this issue · 1 comments

As per a user request, it may be feasible to convert selected rectangles into placeholder texts. Since the current process of creating placeholder text is a little cumbersome, cf. [State now], adding this functionality could decrease the effort to create placeholder text even further, cf. [State after].

[State before]

Process of creating placeholder text:

  • Select the text tool: T
  • Create a text area: Left-click and drag with mouse
  • Enter some strings so the text area doesn't disappear when clicking away from it: A
  • Exit text edit mode: ESC
  • Run plugin: Ctrl/Cmd+Alt/Opt+L
  • Confirm settings: Return
  • Done

[State after]

The before is still possible, but additionally, it's also possible to:

  • Select the rectangle tool: R
  • Create a rectangle: Left-click and drag with mouse
  • Run plugin: Ctrl/Cmd+Alt/Opt+L
  • Confirm settings: Return
  • Done

Proposed implementation

In

, add a condition for sceneNode instanceof Rectangle. In this condition, create an area text Text with the dimensions of the sceneNode. After that, replace the sceneNode with the new rectangle (also in selection.items) and call applyToAreaText().

Estimation

1 hour for implementation
1 hour for tests (extending the scenegraph mocks to cover the "replace a node" case)