-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce b.addToText(), discontinue b.addToStory() #72
Comments
@b-g: As you started the discussion about the »addToStory with styles« initially, I would like to hear your opinion on my suggestion to introduce »addToText()« and discontinue »addToStory()« (see my explanations above). If you approve, I would assign myself to this issue and start to work on this. At the moment the method is not working at all anyways, so something needs to be done. |
Hi @trych, Sorry for the radio silence! The proposed Good would be if
|
Great!
Good idea, will include this. |
@b-g As we now have b.applyCharacterStyle( b.addToText( myTextFrame, "my text" ), myCharStyle); to apply a style to the added text. This would keep What do you think? |
@trych super! +1 for b.applyCharacterStyle( b.addToText( myTextFrame, "my text" ), myCharStyle); Side note: I guess the only missing function in that realm is then something like |
Yes, we should use And another side note: a text object that is still missing is |
hi @trych +1 to Can you elaborate what do you mean with Cheers, B |
hi @b-g
No, I think
In ExtendScript a textStyleRange is another InDesign text class, just like It can be quite useful to return these textStyleRanges, so I think we should also include it as |
@trych thanks for the explanation + wasn't aware of this ... |
Apart from the fact that
b.addToStory()
does not work at the moment ( #71 ) , I think it could also improved structurally. This was mentioned in another issue ( #44 ), so I will mostly copy/paste to this issue here.I think the method could become more "basil like" beginner friendly, if it was changed in these ways:
1) Skip the requirement to have a
story
object instance as input. It is quite difficult to retrieve a specificstory
object within the basil.js universe and I guess many beginners don't know what astory
actually is. How it could work instead: AllowtextFrames
as input.textFrames
are a whole lot easier to address in basil.js and a much easier and much less concept for beginners. The new texts could be added at the beginning at the end or somewhere within thetextFrame
. Should text then move to the next linkedtextFrame
or into overset text, it will be obvious. Additionally we could allowparagraphs
,lines
,words
,characters
(and yes, why not,stories
) as input. This could also be convenient, if you found aword
already then you could easily just add text to it. So the whole method rather becomes a "b.addToText()
" (and should be renamed accordingly) and easier to use, I think.2) Instead of an
insertionPoint
as input I would also allow for a simple index. Same as withstories
, there is no way in basil to retrieve aninsertionPoint
(or is there?) and beginners don't know what aninsertionPoint
is (let alone that it is an object, not a "index like" position). So if we give the option to use a simple number as index, I think it would be also much easier for beginners.And we could also include the "add in certain (paragraph|character) style" feature that @b-g proposed in #44.
So the specific method would be:
b.addText({textframe|story|paragraph|line|word|character}, text, [index|insertionPoint|b.AT_BEGINNING|b.AT_END],[characterStyle|paragraphStyle] )
If others like the idea, too, the question is, if we should then discontinue the b.addToStory() method. Usually I would be all for staying backwards compatible, but this feature has not been working for almost three years now (does not work in 1.08), so I think we could take it out of the official reference and replace it by b.addToText().
We could still leave a b.addToStory method in the code that throws a basil.js warning: b.addToStory(), this method is deprecated. Please use b.addToText() instead. Or simply let the b.addToStory() method run the b.addToText() method (as it is compatible regarding the inputs).
Please flag as enhancement and feature.
The text was updated successfully, but these errors were encountered: