Feature Suggestion -- syntax highlighter #305
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#305
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a feature suggestion.
It could be very usefull feature to make new fieldtype with syntax highlight and implement it to the jcb custom scripting textarea
Expected result
https://highlightjs.org/
or some thing like that joomla
Actual result
just text area
Additional comments
jcb takes some of the ide's features to simplify component development. On the other hand, the lack of syntax highlighting complicates the work with it
This is a wonderful idea, and something we have also been talking about. We are also thinking about code hinting.
How much can you contribute to make this happen?
@ro-ot, Sorry, I'm not a native speaker and I'm not an active github user. So I'm not sure I got you right. Explain in detail what is required of me?
Ok, well I am simply asking, if you can help code this.
Ok. I think that this task consists of three parts:
the first part I will provide
Textarea doesn't fit.
need fieldtype "editor" with a non-default editor,
create an options of creating the field . In this option user shoud enter the installed editor like codemirror. and choose theme of highlight.
the easiest way to use instead of textarea field type editor field type and
plugin
and change the theme in codemirror plugin settings on the appearance options tab
the plugin is not even needed.
In the field options with the type "editor" there is an editor item
that's all
The reason we did not go that direction is because the editors post via the site safety filters of Joomla and PHP is not allowed in most cases.
So what happens is, if you save a view/item that has php script in a field, or even JavaScript, the editor breaks it and often strips most of it away.
Have you been able to get it to work with PHP code snippets? I must admit I am speaking about four years ago, so it may have improved since. Just been to occupied to look, can you test this for us and give me some feedback? We are willing to change this, I mean why not... if it will work with PHP and JavaScript without stripping any code.
Okay I just ran a test with a field in the admin view, and since the field is set as required it keeps saying that the field is empty. I then realized that it is due to the values being kept in the input field build by the editor, and so the form does not want to submit.
Any ideas how I can fix this? My JavaScript is not that great.
This is the xml for the field that JCB builds, even if I remove the required field it gives the following error.
in com_templates " PHP " saving and highlighting works well. The keyword responsible for the correct display of " php " is " syntax" use search through folder.
And don't forget that some fields in JCB work with out "< ? php ?>". Plane changing their fieldtype would not work.
Okay I have been able to get it to work, I am updating all the fields in the admin view that takes custom code. Then we can test...
Please test the converted fields that are now editor fields inside the admin view of JCB (staging branch)
it's hard to test for me because I haven't used these fields until now
And now I meet with a mistakes, because I do not understand how they work yet.
it will take some time to master these fields. Now I just can say that highlighting is worked.
Same fields in admin view were missed. 1,2) javascript footer and footers 3) Add Custom Import
Yes the idea is just to test that the field work, in submission/save of the view. Not in relation to its implementation to a component. Since that has not changed, does still work well.
The fields we have skipped are more complex and may take some time to convert. Specially all those related to the custom import option.
I will now start moving other areas to this implementation. I have learned to code without the editorial help of an editor, but this change is very welcome, and will make it much easier for others.
I have been running some tests and it seems like the editor is not always loading correctly, specially with areas that already has code.
The code does not show until you click in the box. So here I have a field with code, but it does not show.
So when I click in the editor it loads the code, but behind the line numbers.
This is with Joomla 3.8.10
Codemirror has become unstable with the last Joomla release. So I am pausing this feature request until further notice.
Сan you describe what is unstable? And give me a link to download and test version with codemirror, please?
Well just download the latest JCB (staging branch) and try to save any code area that uses codemirror (Joomla default code editor) and you will see with the new Joomla 3.8.10 it does not work. I have been trying all kinds of validation, filters and yet it still continues to block the submission of the new custom code all over JCB.
I have tested this in other areas of Joomla, and it seems to work. But I can not find the problem ,already spend three days on this, so I am a little fed up.