I'm building a UXP panel for Adobe InDesign, and I'm trying to extract the contents of a selected text frame using:
const selection = app.selection;
const selectedItem = selection[0];
const text = selectedItem.contents;
Although the item is confirmed to be a TextFrame, and there is clearly text inside it, the .contents property returns undefined. I’ve verified the selection object:
console.log('Selected:', selection);
console.log(Object.keys(selection));
Still, I'm not getting the expected text.
Is there something different in UXP or InDesign's API I should be aware of when accessing text frame content?
The full code, look like this code bellow:
function testTextFrameContents() {
try {
const selection = app.selection;
if (!selection || selection.length === 0) {
console.log("⚠️ Nothing is selected.");
return;
}
const selectedItem = selection[0];
console.log("
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744208498a4563222.html
评论列表(0条)