Text object api bug?

Issue

A plugin setting text in a newly-created text object results in the object disappearing.

Steps to reproduce

Create a new text frame, but don’t type anything.

Have a plugin use the textNode.text = "anything" to assign the currently-selected node’s text content.

Expected Behavior

The text node’s content becomes anything.

Actual Behavior

The text node disappears from the scene.

If you type anything before invoking the plugin (just a single character is enough), then the .text assignment works and replaces what you’ve typed.

Maybe stupid error on my part?

If it’s not, it’s a pretty serious bug or missing feature (call it what you like), because it means that a plugin can’t supply the contents of a newly-created text object.

In XD, empty text nodes, unfortunately, don’t exist. I remember this already being a topic in the prerelease before the MAX last year, which lead to the menu items not being accessible as long as the text node gets edited. I assume you now reach the plugin via the panel, in which it, prosumably, is accessible while editing text?

Basically, as soon as you leave the “edit text” mode of a text layer (e.g., by clicking on a plugin or anything else), it, if empty, gets deleted, meaning the selection will no longer include the (no removed) text layer…

Right, so I guess I’m asking for a feature: if a nascent text node has its .text property assigned by a plugin, make it “real” just like typing would.

This would solve the problem of “maximum surprise” the user currently experiences with a plugin “typing” vs a human typing, where the object you’re standing on just disappears beneath your feet.

The problem here is that most actions aren’t allowed while in text-edit mode (including running plugins), so the text-editing mode is automatically terminated before your plugin gets run. You’ll see the same behavior if you, say, click the Shadow checkbox in XD’s properties panel while you are actively editing text that is still empty.

In the more common case where the text isn’t blank, this is a lot less confusing: the Text node sticks around, and the action the user tried to do is applied to it as they expected.

Right, but what would be ideal is for the assignment of .text from a plugin to act exactly like the user typing something.

So I’m asking you to consider changing the UX of text-edit mode: if someone’s creating a text node but hasn’t typed anything, let at least panel plugins run and allow them to set content as a proxy for the user’s typing.