By paragraph, do you mean a text that has a box around it?
You can check for the textKey.textShape[0].bounds property I think, this one does not exist for text without any box limitation.
You are correct about textKey.textShape[0].bounds being missing when the layer is point text. Also, I found under textShape where the property is stored. Under textKey.textShape[0].char._value it will return “box” for paragraph text mode and “paint” for point text mode… I’m assuming “paint” is actually “point” and they share the same 4 character string.
Anyway, I am posting the working function here in case someone needs it down the road. This function will return true if the activate layer is a paragraph text layer. It returns false if the active layer is a point text layer or is not a text layer.
async function isParagraphText(){
const result = await batchPlay(
[
{
"_obj": "get",
"_target": [
{
"_property": "textKey"
},
{
"_ref": "layer",
"_enum": "ordinal",
"_value": "targetEnum"
},
{
"_ref": "document",
"_enum": "ordinal",
"_value": "targetEnum"
}
],
"_options": {
"dialogOptions": "dontDisplay"
}
}
],{
"synchronousExecution": false,
"modalBehavior": "fail"
});
let paragraphText=false;
try{
if(result[0].textKey.textShape[0].char._value=="box"){paragraphText=true}
}
catch(e){}
//returns true if active layer is paragraph text
//returns false if activate layer is point text or is not a text layer
return paragraphText;
}
Ah okay, even better then, that there’s a property specifically for the text mode. I just quickly scanned the differences and the bounds property was the first thing to jump into my eye.
Yep, there are many places where it’s paint instead of point.