Opened 17 years ago

Last modified 11 years ago

#602 confirmed New Feature

Syntax highlight and go to line

Reported by: objectcat@… Owned by:
Priority: Normal Milestone:
Component: UI : Source View Version: 3.0
Keywords: SF HasPatch Cc: icesoftware@…, orfjackal@…

Description

It would be a great idea to be able to use highlighting in source mode like you get in some text editors for coding.

a button for go to line would be great because sometimes you have this huuuge files and you got an error on line 345. Would be great for debugging.


Moved from SF:
http://sourceforge.net/tracker/index.php?func=detail&aid=972673&group_id=75348&atid=543656

Change History (14)

comment:1 Changed 17 years ago by Martin Kou

Cc: icesoftware@… orfjackal@… added
Reporter: changed from Martin Kou to objectcat@…

Hi everyone!

I did that this way... put this JavaScript code in your page (like before </HEAD>):

<script type="text/javascript">
var ultimaLinea = -1, coll;
function resettaRiga()
{
         if (ultimaLinea >= 0)
         {
         coll(ultimaLinea-1).style.backgroundColor="";
         ultimaLinea = -1;
         }
}
function vaiAriga(riga)
{
var ilframe = (document.getElementById
('FCKeditor1___Frame').contentWindow.document.getElement
ById('eEditorArea')).contentWindow;
         if (riga == "") return false;
         riga = riga.replace(/^\s*|\s*$/g,"");
         if (isNaN(riga) || riga==0) return false;
         resettaRiga();
         coll=ilframe.document.all.tags("P");
         ilframe.document.body.onclick=resettaRiga;
         if (coll.length >= riga)
         {
         ultimaLinea = riga;
         coll(riga-1).style.backgroundColor="yellow";
         coll(riga-1).scrollIntoView(true);
         }
         return true;
        }
</script>

If your editor is not called FCKeditor1 adjust that. Then you put a button and an input field in your form:

<INPUT type="button" value="Vai a riga" class="S4NBOTT" 
onclick="vaiAriga(getElementById('NumRiga').value);">
<INPUT Id="NumRiga" name="NumRiga" type="text" 
class="S4NEDIT" size="4" maxlength="4">

Hope this is useful to you!

ACL


Moved from SF. Original poster: icesoftware

I would really much like this feature to be added. Syntax highlighting for the source view would help the writing of code very much. Right now it is necessary to copy the source code to and external editor and paste it back to the browser.

Could somebody help me to find the right places from the code, so I could try adding syntax highlighting myself?


Moved from SF. Original poster: orfjackal

comment:2 Changed 16 years ago by Alfonso Martínez de Lizarrondo

Component: GeneralUI : Source View

comment:3 Changed 16 years ago by Wojciech Olchawa

Keywords: Confirmed added

comment:4 Changed 16 years ago by Wojciech Olchawa

Keywords: HasPatch added

comment:5 Changed 16 years ago by Wojciech Olchawa

#612 has been marked as DUP. View #612 - it has a lot of information about this feature.

comment:6 Changed 16 years ago by Frederico Caldeira Knabben

#2360 has been marked as DUP.

comment:7 Changed 16 years ago by dricks2222

CodeMirror does this kind of thing very very well. http://marijn.haverbeke.nl/codemirror/

Example of mixed parsers(html/css/javascript) highlighting : http://marijn.haverbeke.nl/codemirror/mixedtest.html

Integrate this into FCKEditor would be just great.

comment:8 Changed 15 years ago by Dan Dascalescu

Summary: highlight and go to lineSyntagx highlight and go to line

Seconding CodeMirror, as I wrote a PHP parser which the author integrated in the package. Here is a demo of PHP+HTML+JavaScript+CSS:

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

HTH, Dan Dascalescu

comment:9 Changed 13 years ago by Wiktor Walc

Summary: Syntagx highlight and go to lineSyntax highlight and go to line

comment:10 Changed 13 years ago by Wiktor Walc

Version: 3.0

comment:11 Changed 13 years ago by Adam

Suggestions:

Reference plugin that's integrated. It was made by someone in this thread.

One thing it lacks is some indicator on the non-source side to show where the code snips are. Without that it's too easy to delete them if they are intertwined with the text. Some block character would be good.

Also, if there's going to be a 'go to line', there should also be line numbering to go with it.

comment:12 Changed 12 years ago by apatheticresistance

The website that was hosting that plugin seems to have disappeared. Does anybody have access to it, or a newer version? Thanks!

comment:13 Changed 12 years ago by Jakub Ś

@apatheticresistance In http://cksource.com/forums/viewforum.php?f=18 you can find three plugins for syntax highlighting:

  1. http://cksource.com/forums/viewtopic.php?f=18&t=24279
  2. http://cksource.com/forums/viewtopic.php?f=18&t=23737
  3. http://cksource.com/forums/viewtopic.php?f=18&t=23736

The last two are based on: http://alexgorbatchev.com/SyntaxHighlighter/

If none of those solutions suits you maybe you could use them as a jump start in your own plugin.

comment:14 Changed 11 years ago by sirtet

actually, 2. and 3. are about highlighting code in your content, not for the source, as asked here. The latter is done by 1. only, but you can directly use this Plugin now: http://ckeditor.com/addon/codemirror

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy