Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Possible to select only text nodes? #1

Open
andyjamesn opened this issue Mar 29, 2023 · 3 comments
Open

Possible to select only text nodes? #1

andyjamesn opened this issue Mar 29, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@andyjamesn
Copy link

andyjamesn commented Mar 29, 2023

I stumbled on this repo and it is a handy tool to use for a translation project I am working on.

The main requirement is to change existing text and replace images.

Currently if I select an empty grid column for example I can add text and if I move up and down I can edit the html.

Is there a way to make it so only text nodes or dom elements with a text child are selectable and editable? I want to prevent the ability to edit existing html structure.

Thanks for the amazing work!

@ghost
Copy link

ghost commented Mar 29, 2023

It is not possible, by default "body" is marked as editable, if we want to edit a "div" or a class, only the first element will be editable: https://github.com/TheNocoder/ncSimpleHtmlEditor#options

Still, I think the script will do the job you describe well, although it would indeed be much better if arbitrary selectors could be added.

Edit:

I forgot to mention that double clicking on an element brings up the window to edit that particular element.

@ghost ghost added the enhancement New feature or request label Mar 29, 2023
@andyjamesn
Copy link
Author

andyjamesn commented Mar 29, 2023

Ok thanks for getting back to me. I need to think how it could work as I need to make sure users can't edit existing markup which could break the layout structure.

I did see the double click option where there are more options.

It would be great if the editable option could accept a class such as editable: '.editable' and any element with that class became editable.

But I understand this is probably a big change.

@ghost
Copy link

ghost commented Mar 30, 2023

The utility would need to be completely redesigned.

The solution would come from adding an option to prohibit or allow certain selectors.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant