I am putting the finishing touches to a custom written (pHp) article editor to allow users to publish content on a website.
I have basically finished the project, and I am putting the finishing touches in with jquery widgets, such as a word counter. I would also like people to be able to highlight a section of text, then have some custom tags wrap the text (much like on this forum when you highlight a word in the message box and hit the wrap button).
I would like my own custom tags to be used, such as <span class=‘someclass’>some entered text</span> rather than predefined ones.
Would someone be kind enought to recommend a lightweight soloution to this problem?
I opted to initalize the code via a function and pass in the values - works well. Maintence isnt much of a problem because im using pHp to process the page!
Im sure ill be back later on to pester you some more when I come to add some icons!
You could probably put the initialisation code in a function and pass in the ID of the <select> and the <textarea> (That would be the simplest, though little bit maintenance-heavy, solution).
The other way to do it would be do have a markup structure like this:
The “//” at the start will request the file with the protocol currently being used. Handy if you ever need to include things like the CDN version of jQuery on a site that uses both http and https. Of course when viewed locally without a webserver to host it (i.e. via the file:// protocol) it will fail because it try to use the “file” protocol to request jQuery.
After some consideration I have decided that an editor is not restrictive enough for my needs and I really only want a few custom tags to be available.
So John’s solution seems ideal, only I just copied and pasted the code into a document at nothing seems to be happening when i select an option from the menu