-
Notifications
You must be signed in to change notification settings - Fork 74
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
Text manipulation API to be used with macros #368
Comments
@oliver----, I know how to iterate through each text node, but whet it comes to updating one text string... I don't know who to do it without annotations crushing. |
This is now possible using transformations. https://github.com/substance/substance/tree/master/src/document/transformations You can use the insertText transformation like so:
|
... when you have a batch of changes on the same property, make sure to replace from right to left... |
Hmmm. But, probably you are not ready to switch to the new API... Still... you can take a look at the impl of insertText to see how it works with the old API. |
Annotation updates are done using https://github.com/substance/substance/blob/master/src/document/annotation_updates.js |
@oliver----, thanks! |
Yes, should be possible on server side. |
Just be aware that you don't mix different substance versions. The Archivist-Composer needs to stay on the old version until we make an upgrade iteration. So I think you should create independent command line versions of importers etc. that don't clash with the Composer implementation. |
Great, thanks! On 30 June 2015 at 13:09, Michael Aufreiter [email protected]
|
Hey can you try the following in the archivist repo: in Package JSON create an entry {
"substance-new": "substance/substance#master",
} And then in importers: var Substance = require("substance-new"); |
not sure if that works but that would be the best solution i guess. |
Good idea! Will try soon. On 30 June 2015 at 13:18, Michael Aufreiter [email protected]
|
@michael, no it's not possible. NPM will store substance-new in the same folder inside node_modules |
I will use this. It's combination of delete/insert updates. I could use it while document has no annotation. Next challenge would be to use this with already annotated docs somehow... |
Hey!
I most say... You really need some documentation for core library. It's very hard to trace what you need to do. |
Yes. That's true. will come soon. |
Daniel wants to write a macro that manipulates text on the document. In order to not loose the annotations he'd have to use the TextOperation API.
@oliver---- What would he need to do in order to remove a certain word from all paragraphs, leaving the annotations intact?
Should we think about creating an abstraction API that makes such things easier?
The text was updated successfully, but these errors were encountered: