Jump to content

[SOLVED] HTML Syntax Highlighting


x1nick

Recommended Posts

This is just something I would like to integrate into my template system im building, but don't know how possible it is.

 

All I want to be able to do is highlight html code within a text area, and have it automatically highlight as writing the code.

 

 

Link to comment
Share on other sites

Found the perfect solution to my problem.

 

http://marijn.haverbeke.nl/codemirror/

 

Now my problem is that I don't know how to insert my {tpl} var's into the textarea.

 

I guess the codemirror function...

this.mirror.insertIntoLine (tpltextarea, this.mirror.cursorPosition(this.mirror.firstLine()), 'text');

Would do the job, I just not too sure how the position works

 

The above line of code puts it into the text area, but not where is selected, just at the end of the textarea.

 

 

Link to comment
Share on other sites

Hmm

 

Think I have solved the problem to what I posted before.

Just used self.mirror.replaceSelection(myvar)

 

Now the next problem, I want to incorporate some form of ajax save so it allows for quick easy saving of the files being edited.

 

Problem with this is codemirror replaces the id tag of the textarea so I can't use it with ajax.

 

So tried incorporating it into the mirrorframe file.

 

Would have though the function getCode is what I need to use. So tried this and it just returns undefined.

 

Most likely there is a simple fix for this. but for now im stuck

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.