GetmeUK / ContentTools

A JS library for building WYSIWYG editors for HTML content.
http://getcontenttools.com
MIT License
3.95k stars 395 forks source link

how to handle repeated/duplicated keys? #543

Open seltix5 opened 5 years ago

seltix5 commented 5 years ago

hello, I found this tool and I think the idea is amazing! I was doing a implementation test and... when using this tool to translate text, how should I handle the repeated/duplicated keys in the page ?

for example, a table : image

not only there wold be a problem with the post process to save the post data but also when I stop the tool only the last editable field is disabled :

image

any idea about how to approach this problem?

thanks!

anthonyjb commented 5 years ago

Hey @seltix5 can you send me the HTML that's being generated? If you're using fixtures then I'd recommend just generating a key of the form my-key-prefix_{uuid}? We use dynamic keys for fixture data extensively without issue so hopefully this would be an option?

seltix5 commented 5 years ago

hello, this is the code generated in the example : <lang style="display:inline-block;" data-fixture="" data-ce-tag="p" data-name="lang.translations.pt-PT.ecommerce.orders.waitingpayment" class="ce-element ce-element--type-text">A aguardar pagamento</lang> But if I use that dynamic key they will be treated as different text, but they do are the same text.

For a quick fix from my side the only option I can see is control what keys are requested and ignore keys already requested and just return the text without the html for ContentTool.

A great option wold be to treat the fixture with the same key as equal, if one is updated the others are updated too with the same text.