I'm attempting to install a the "codesample" TinyMCE plugin to enable code syntax highlighting in Keystone.js. I added the following line to the keystone.init section of the keystone.js file per the documentation. However, no extra button to enable syntax highlighting appears.
'wysiwyg additional plugins': 'codesample',
'wysiwyg additional options': {
external_plugins: {
'codesample':'/js/tinymce/plugin.min.js'
}
The plugin documentation says that a code highlight button is included as part of the plugin. Since the button did not show up I attempted to force it by adding the following line.
'wysiwyg additional buttons': 'codesample',
No errors are showing up on the console. I'd appreciate any help in getting this or some other form of code syntax highlighting working with KeystoneJS.
You can get the plugin included with TinyMCE working by putting this in your keystone.init function:
'wysiwyg additional plugins': 'codesample',
'wysiwyg additional buttons': 'codesample',
But when I did this, although it got it working, it seemed like you can create code samples, but not edit them, unless you delete & remake them. I tried replacing the TinyMCE version included with keystone (majorVersion:"4",minorVersion:"4.3") with a newer one, as 5.2 and beyond claims to have fixed this issue, but it didn't do me any good.
Perhaps you'd have better luck installing the plugin this way, treating it as an external plugin:
'wysiwyg additional options': {
skin : 'lightgray',
menubar : 'file edit format view insert',
relative_urls: false,
content_css: '/assets/css/styles.min.css',
visualblocks_default_state: true,
external_plugins: {
'tinyvision':'/assets/plugins/tinyvision/build/plugin.min.js'
},
tinyvision: {
source: '/api/images'
}
}
Reference: https://github.com/keystonejs/keystone/issues/1549
Slightly less useful reference: http://keystonejs.com/docs/configuration/#options-ui
Related
We are using Tiny MCE 3 for a tool that is to be used for internal projects only so mandatory alt attribute on image tags is overkill.
When using the Insert/Edit Image dialogue, there is confirm dialogue (see below) that asks if you want to continue without an Image Description.
How do I suppress this dialogue so we can add images quicker (and dirtier)? I have had no luck with Google or the TinyMCE docs on this one.
Note this is for Tiny MCE 3.x, although we may migrate in the near future to 4.0.
You can do one of two things to change this...
Configuration Setting accessibility_warnings:
There is a setting you can put in the configuration that will turn off all accessibility warnings:
tinyMCE.init({
...
accessibility_warnings : false
});
Modify source code of image.js in the advimage plugin
This file has code to check for the alt attribute. In TinyMCE 3.5.10 I see this on line 104:
if (tinyMCEPopup.getParam("accessibility_warnings", 1)) {
if (!f.alt.value) {
tinyMCEPopup.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'),
function(s) {
if (s)
t.insertAndClose();
});
return;
}
}
If you comment that out it won't check for the alt attribute anymore. Of course you now have to re-do this change if you install an update to TinyMCE.
As a side note TinyMCE 3 is no longer getting any updates (I work for the company that owns TinyMCE). It would be a really good idea to move to TinyMCE 4 (currently at 4.5.3) as that is the codebase that is getting enhancements at this point.
I have been trying to find a proper way to highlight React Code in '.js' files so that it is easier to read in Visual Studio Code. The photo below shows a sample file of how a lot of it is in one color, making it hard to read.
I tried using "jsx" extension by TwentyChung and "react-beautify", but neither of them worked. Can someone please assist? :-)
Change the VS CODE color theme to Dark+ and change the language in bottom status bar to java script react. This worked for me
JSX highlighting works out of the box in VS code and JSX files are already associated with JavaScript React language mode. If you want to enable JSX syntax coloring in .js files click on the language name in the status bar and select JavaScript React language mode. You can also associate .js files with JavaScript React if you don't want to do this every time. Make sure you have the latest version of VS Code.
Disabling this extension fixed it for me. It specifically happened this day November 17,2022 3 of my workmates were having the same problem.
Just uninstall this plugin and install it again in the vs code extensions:
Name: JavaScript and TypeScript Nightly
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-next
I just added this to settings.json and it worked for me, so you can give it a try.
"files.associations": {
"*.js": "typescriptreact"
}
For Me Here is what worked
Update the vscode by downloading the latest verrsion
https://code.visualstudio.com/download
2.Open Vscode click extension and search this extension
Javascript Atom Gramar
Just disable the extension.
3.Close and open vscode, now u should see colors in your jsx code.
Hope this will help some one in future
disable the extension named Javascript Atom Grammar works for me
Select Language mode as "Javascript React".
Go to Settings -> Color theme -> Select "Dark+" theme.
Click: Ctrl + K + T
Change the color theme settings to dark+(default) , it worked for me.
And select the appropriate language from bottom status bar:
VS Code highlights code via extensions, not with ESLint or Prettier, which are sometimes assumed to do the job. Out of the box, VS Code supports React and JSX natively. You can also adjust VS Code's settings.json file. Here's an example off how that might look:
{
"window.zoomLevel": 0,
// Solarized-dark theme
"workbench.colorTheme": "Solarized-dark",
// Changes the highlight color in solarized-dark, which I can't see
"workbench.colorCustomizations": {
"editor.selectionBackground": "#5b455e",
"editorBracketMatch.border": "#555",
"editorBracketMatch.background": "#5b455e"
},
// Number of spaces in a tab
"editor.tabSize": 2,
// Insert spaces when pressing Tab. This setting is overriden
// based on the file contents when `editor.detectIndentation` is true.
"editor.insertSpaces": true,
// Override whatever the files say and give me 2 spaces per tab
"editor.detectIndentation": false,
"workbench.startupEditor": "newUntitledFile",
"explorer.confirmDelete": false,
"explorer.confirmDragAndDrop": false,
"javascript.updateImportsOnFileMove.enabled": "always"
}
VS Code modifies syntax highlighting automatically, but it's not perfect. You can also adjust the detection by clicking on the auto-detected language on the right side of the bottom toolbar:
I am using ckeditor in a Rails4 project. I have tried both the ckeditor gem and the ckeditor_rails gem to provide the ckeditor libraries.
There are multiple posts here by people wanting to remove the ckeditor context menu so that the native browser context menu can be displayed.
This is usually to enable the browser spellchecker to be used rather than the ckeditor paid / advertised spellchecker.
how-to-remove-contextmenu-in-ckeditor-4-3
ckeditor-3-6-3-enable-browser-spellcheck-and-disable-context-menu
how-to-disable-ckeditor-context-menu/20229730#20229730
The third link has the most replies but none of them are universally accepted.
Generally the reply is to remove the contextmenu plugin by placing the following in the ckeditor config.js
config.removePlugins = 'contextmenu';
There is also the suggestion that contextmenu is a dependency on other plugins and different people add a multitude of other plugins to be removed as well.
One helpful post suggests running the following code in the console to establish the dependencies.
$.each(CKEDITOR.plugins, function(k, v){
v.requires && console.log("Plugin '" + k + "' requires: " + v.requires)
})
This seems to work well and suggests that tabletools and liststyle plugin is dependent on contextmenu. So we end up with
config.removePlugins = 'liststyle,tabletools,contextmenu';
Unfortunately this does not disable the context menu in the version of ckeditor that I am using (4.4.6 established by adding alert(CKEDITOR.version) in the config.js)
Finally there is a suggestion to use the following code in config.js
CKEDITOR.on('instanceReady', function(ev) {
ev.editor.editable().addClass('cke_enable_context_menu')
});
There is no suggestion as to how this is meant to disable the context menu but in any case it makes no difference for me.
For me this is a showstopper as the ckeditor context menu hides the browser spelling suggestions and the cut and paste options it contains do not actually work but just bring up the browser dialog.
Your browser security settings don't permit the editor to
automatically execute copying operations. Please use the keyboard for
that (Ctrl/Cmd+C).
In all other aspects ckeditor does seem to be the best functioning editor out there.
In my Drupal 7 environment, loading ckeditor from the CDN, current version is 4.11.4.
The only thing that worked for me after many failed alternatives:
config.removePlugins = 'liststyle,tableselection,tabletools,tableresize,contextmenu';
For convenience, I put this in the module configuration settings -> Advanced -> Custom JavaScript configuration, but in my experience the same result can be achieved in the ckeditor.config.js file in the module folder.
(It's just more likely to get accidentally overwritten there, when updating the module. ... you could also do it by checking the option to use the config.js file in your theme and then adding the line above to that file.)
As simple as that:
CKEDITOR.replace( 'textarea', {
removePlugins: 'contextmenu,tabletools'
} );
If it does not help you, you must include a valid sample to reproduce the issue because something exotic is going on in your setup.
If anyone is looking on how to disable the context menu and have access to the native browser spellchecker in CKEditor:
CKEDITOR.replace( 'editor1', {
removePlugins: 'contextmenu,liststyle,tabletools,tableselection',
disableNativeSpellChecker: false
} );
(tested on CKEditor 4.7.0, standard package)
I like to add a map to an image in the ckeditor. I use version 4.2 Standard Package and I would be totally fine if i do that in the sourcecode area. The problem for me is that it removes the map code completely. Does anyone know where I can tell ckeditor to keep my tags?
I've found How to insert image/area map into picture from CKEDITOR 3.0 for the older version. Maybe there exisits a plugin for that?
I've found the config parameter, if you set allowedContent: true then the tag filter is turned off.
Example:
CKEDITOR.replace( 'myTextarea', {
allowedContent: true,
});
When using the find/replace plugin for ckeditor it is greyed out on the source view. To enable this I have found that you need to add:
modes: { wysiwyg:1, source:1 }
However, i wont lie, im pretty unsure where this should be placed.
It hopefully can be found in this link http://jsfiddle.net/SBmKz/ as it is 384 lines long.
I have tried researching this and have found a few examples of it in other plugins and also how it is done in the ckeditor.js (n.modes={wysiwyg:1,source:1}) but cant seem to get it to work within this plugin.
Many thanks
Find/replace option is created to work on DOM, not on a plain text. That's why it is disabled in source mode. Actually, it would be a completely new feature the find/replace in source mode - especially if it had to omit tags.