Skip to main content
dublove
Legend
July 27, 2026
Answered

How do I distinguish between selecting partial text or selecting the entire story?

  • July 27, 2026
  • 1 reply
  • 38 views

Hi everyone.

If I select partial text, I will clear the preference for the selected text.
If all text (the whole story) is selected, priority will be given to clearing all objects under the story.
I found that I selected the entire story and only selected some of the text,
The results of alert (app. selection [0]. constructor. name) are all
Text.
How can I distinguish between these two states?

thank you.

    Correct answer Manan Joshi

    app.selection[0].parentStory.contents.length would give you the length of the parentStory

    1 reply

    Community Expert
    July 27, 2026

    The 1st though that comes to mind is check the character count. Get the parentStory and its length and match it with the selection length. If it matches you have the story selected, else it is subset selection

    -Manan
    dublove
    dubloveAuthor
    Legend
    July 27, 2026

    It seems like this.
    But I don't know how to obtain the content and length of the entire story.

    if (
    (app.selection[0].constructor.name == "Text")
    ) {
    var item = app.selection[0];
    var text = item
    curStory = text.parent;

    alert(text.length);
    alert(curStory.texts);
    //clear(text)
    }

     

    Manan JoshiCommunity ExpertCorrect answer
    Community Expert
    July 27, 2026

    app.selection[0].parentStory.contents.length would give you the length of the parentStory

    -Manan