Highlight javascript inside HTML in Atom editor - javascript

So, I'm new in Atom, and I noticed that when I use <script> in HTML, it won't highlight anything, I'd like to know if this is normal, and if it is, how to make Atom highlight JavaScript inside <script> tag within HTML?

Go to the settings core tab and uncheck Use Tree Sitter Parsers option. Should work without restarting atom.

I had the same issues. The solution is to install a new theme.
Minimal-syntax-dark

Related

How to disable style editor

I am experimenting with grapes js page builder with the webpage plugin.
The issue is that I was not able to find a way to completely disable the style editor they have (I managed to not auto-select the style manager when you click an element) but I want to completely remove the option for the user to edit existing styles.
Basically the user must only be able to drag existing blocks and edit the text inside them and not style them in any way.
You can also acheive this by changing the "appendTo" property of the Style Manager config to a new div that's not in the DOM
const editor = grapesjs.init({
styleManager: {
appendTo: document.createElement('div'),
},
...
})
This way, the style manager simply won't be rendered.
The way I solved the issue was by copy & pasting the node_modules/grapesjs-preset-webpage/src/panels/index.js and simply commenting out the code that was defining the panel I wanted to get rid of.
I also had the copy and paste the node_modules/grapesjs-preset-webpage/src/index.js and editing it to import my panels.js file.
Not the best way of doing this for sure but for now that will do.
PS.
I also thought of simply hiding the panel using CSS but that seemed more of a hack than this.

Javascript WYSIWYG that ignores PHP Code with Bootstrap3

I'm adding an *.php editor to a CMS similar to as is done in Drupal's node editor. Currently, I have a selectbox with the values WYSIWYG and PHP Code. If WYSIWYG is selected then code inside the text area will be parsed with something like Tinymce (I've read other answers and found markitup.jaysalvat.com but that seemed WYSIWYG less). Whatever the javascript editor, I'd like (or will be building) a bootstrap front end to allow col, rows, btn, etc.
If PHP Code is selected then the raw PHP code will be shown and editable. I played around with this a little the other day using htmlspecialchars_encode and htmlspecialchars_decode with $_POST and everything seems fine when using PHP Code editor.
However, when I used Tinymce it wrapped all my PHP in paragraph tags, etc. Is anyone aware of a addon or alternative WYSIWYG javascript script that can parse HTML code without messing up PHP code, preferably, but NOT necessarily with builtin Bootstap3 components?
If there is something open source already out there already, it could save me from developing the whole thing from scratch.
Thank you in advance.
Try adding this to your TinyMCE configuration:
protect: [
/<\?php.*?\?>/g // Protect php code
],

CKEditor show block element HTML

I'm using CKEditor version 4.5. I want to configure showing HTML blocks for content.
Please help me.
Please use the Show Blocks plugin in your CKEditor build and it should work. It comes by default in the full-featured preset of CKEditor, but you can also add it to your custom build by using CKBuilder.

HTML file not working in Browser

I have created a simple - HelloWorld.html Webpage with HTML, JavaScript, CSS.
When I run it from Eclipse IDE, It works perfectly on browser.
What it does is like: the page has 5 buttons,
and hellow World is displayed from 5 different <div>'s
that remains hidden and appears as inline after button click.
When I navigate to the work-space and try to open the HelloWorld.html file in browser manually, nothing comes correctly.
All properties: positions and bgcolors etc declared in external css file has no effect on browser.
I know it sounds stupid, but I'm just hating myself for this.
Does anyone know why is it behaving in this way?
PS:
1. I have no Server-side scripting in the file.
2. HTML, JS, CSS are different file.
My best guess would be that you are trying to use the css file with a realtive path, which changes when you don't host it temporarily as eclipse IDE does.
First, open the developer toolbar (f12) & check the network tab to see if the css file is being loaded at all.
Try using an absolute path instead & see if it changes anything.
In my Exp. i have seen this kind of problems many times, the Inbuilt browser of eclipse some times does not support all features especially when you doing like designing purpose.
you can use MS-IE 6 or Above version for same.
or you can try some other browsers like:- Mozilla,Chrome etc.
because it has features for developers for scripting , div , css and many more . so u can check with them.
Thanks,
Arvind
It's because of file manager from which you have opened.
You just need to see the link in browser.
If it has a "content//:" in start then the css or JavaScript file you have linked in the HTML will not work.
What you need to do is change your file manager or create link manually.
To create a link manually you should use "file///:"in start for example if your file is in download then you should use something like that....
file:///storage/emulated/0/Download/My%20Web/index.html
Or you can use ZArchiver file manager and go to your file and use open with option to open file in browser.

Wordpress blocking javascript?

I've tried creating a new post on my Wordpress blog and I've pasted an external code from a site, which has a <script src="..."></script> in order to work.
When I publish my post, the script tag simply gets deleted.
Is this a default behavior in Wordpress? Is there any way to avoid this? (preferably without doing any modifications to Wordpress or using inline code).
No this is not default behaviour in wordpress. I have added <script> tags to the html view of a page or post no problem.
Did you switch the view after you add the code ? If so, don't. Wordpress will delete all tags if you switch to view back from HTML.
Like Tim said, you probably posted the code into the Visual Editor (doesn't accept any HTML tags, like scripts). You should to the HTML editor to implement your code, but if you want to have it on more than one page, you should open up the Appearance Editor and paste it into your theme where you need it (most likely in the header).
If you put the script code in html and then switch to the visual editor, it will delete the script. This is a commonly reported problem and is the default behavior of wp.
Wordpress assigns Roles to Users, Users who are either Administrators or Editors can add javascript codes within posts. If the User's role is Author or Contributor then they can not add javascript codes inside posts, even if these users try to add Javascript in HTML mode, wordpress automatically removes the tags.

Categories