Sg2.9
Do something with a selected...
Recent RSS
Do something with a selected text
From:  Doeke Wartena
Date:  20. March 2010, 14:31

Hi,

I can do something with a selected textbox for example like giving every character a different size.
Only i want to be able to do stuff with selected text instand of all.
Is this possible?

Like how you normally can select a word and make it bold for example.

Re: Do something with a selected text
Date:  20. March 2010, 14:50

You can use the textItem.selection range:

var selectedItems = document.getItems({
	type: TextItem,
	selected: true
});

if(selectedItems.length) {
	var textItem = selectedItems[0];
	var selection = textItem.selection;
	selection.characterStyle.fontSize += 10;
}
Re: Do something with a selected text
From:  Doeke Wartena
Date:  22. March 2010, 20:34

THX A LOT!!

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Shattered 18.03.11