Ace Editor: Disable shadowed line where the cursor is - javascript

I am using Ace editor and I want to disable shadowed line where the cursor is.
Example
I have tried changing themes availables in Ace Mode Creator but all have this line shadowed.
Thanks!

This is a standard setting that doesn't require changing the theme
// e = active editor
e.setHighlightActiveLine(boolean)
Most themes have it set active by default. It should be a standard configurable setting to enable or disable it.

Hi I found the boolean attribute from the Ace demo here (https://ace.c9.io/build/kitchen-sink.html).
Is called Highlight Active Line
I hope it works for you :)

You're looking for:
i.e in chrome theme (https://ace.c9.io/lib/ace/theme/chrome.css) its
.ace-chrome .ace_marker-layer .ace_active-line {
background: none
}

in vuejs just add readonly="true" and I think it's

Related

Is there a way to disable onPageNav or secondary sidebar for a specific page on Docusaurus? [duplicate]

I'm using docusaurus for our dev docs.
How to disable TOC?
Thanks.
Docosaurus has Markdown Frontmatter metadata fields for .md files where you will eventually make use of the hide_table_of_contents field and set it to true.
Your .md should look like:
---
hide_table_of_contents: true
---
# Markdown Features
My Document Markdown content
There does not seem to be a way to make the hide_table_of_contents setting default to true; you need to add it to the Front Matter for every document if you want to completely disable the ToC display.
Another approach to completely disable the ToC display would be to edit the css, adding:
.theme-doc-toc-desktop {
display: none;
}

tinymce - update plugin property after editor initialization

I need to update the colors list after init (or even on init), the plugins is textcolor. I'm using tinyMCE 4.1.9. How can I do that?
maybe in tinymce settings
tinymce.init({
textcolor_map: ["000000", "Black"]
});

CodeMirror: Particular lines readonly

Can I set a particular number of lines (sucessive or not) to read-only mode?
For example: I have a document where I don't want the contents of some sections to be changed (like in Word, where you can set Header and Footer sections and you can lock them).
Anyone know if CodeMirror supports that feature?
Thanks in advance!
There is also markText with the readOnly option, which might map more directly to your use case. See http://codemirror.net/doc/manual.html#markText
With codemirror version 3 support for on and beforeChange was added; simply catching the change before it happens and canceling should do the trick:
// the line numbers to be "readonly"
var readOnlyLines = [0,1,2,3];
// create the CodeMirror instance
var editor = CodeMirror.fromTextArea(document.getElementById('input'));
// listen for the beforeChange event, test the changed line number, and cancel
editor.on('beforeChange',function(cm,change) {
if ( ~readOnlyLines.indexOf(change.from.line) ) {
change.cancel();
}
});
For CodeMirror6
I just released codemirror-readonly-ranges extension that easy allow to work with read-only ranges.
For anyone who is interested on the solution:
package: https://www.npmjs.com/package/codemirror-readonly-ranges
full documentation: https://andrebnassis.github.io/codemirror-readonly-ranges

Turn the Tooltip Bootstrap functionality off

According the documentation is is possible to turn off the functionality just doing $('body').off('.alert.data-api').
In the case of tooltip I tried the following from js console $('body').off('.tooltip.data-api') but it does not disable the tooltip on bottons.
Any hints how to precede?
You can't disable tooltips that way because it has no event listener on the body. Instead, you can disable the tooltips themselves using the code below.
$('[rel=tooltip]').tooltip() // Init tooltips
$('[rel=tooltip]').tooltip('disable') // Disable tooltips
$('[rel=tooltip]').tooltip('enable') // (Re-)enable tooltips
$('[rel=tooltip]').tooltip('destroy') // Hide and destroy tooltips
Edit: For Bootstrap 4, the 'destroy' command has been replaced by the 'dispose' command, so:
$('[rel=tooltip]').tooltip('dispose') // Hide and destroy tooltips in Bootstrap 4
Can you try:
$('a[rel=tooltip]').tooltip();
$('a[rel=tooltip]').off('.tooltip');
Don't forget to change the selector. Works fine for me... http://jsfiddle.net/D9JTZ/
To permanently disable a tooltip:
$('[data-toggle="tooltip"]').tooltip("disable");
To stop the tooltip from being displayed on hover but have the ability to re-enable it:
$('[data-toggle="tooltip"]').tooltip("destroy");
$('[data-toggle="tooltip"]').tooltip(); // re-enabling
I found a way to do it using CSS! Just add .tooltip { visibility: hidden } to your CSS file.
If you want to make your link accessibility friendly without the tooltip, then just add aria-label= "Here's a link description."
Hope this helps!
I struggled too with this, but I came up with a solution!
In my case I use Jquery Sortable which is ofcourse annoying when you have tooltips flying around!
So I made a variable
var sort = '0`;
And since almost every tooltip has an init() function, I created
if(window.sort!='1') { // So I'm not sorting
init.tooltip();
}
So, this can be the easiest enable/disable function!

Reset TinyMCE box

I am using TinyMCE editor. I want to clear the content inside the editor box with some button click present on my form.
Can you let me know how to do so?
This can be easily done (no need to use the slow jQuery tinymce build) using the following code as onclick-action of your button:
// 'content' is tinymce default,
// but if your textarea got an ID that is the one you need!
var my_editor_id = 'content';
// set the content empty
tinymce.get(my_editor_id).setContent('');
From the TinyMCE jQuery Plugin documentation, can be easily found from the page you linked:
// Will change the contents of an textarea with the ID "someeditor"
$('#someeditor').html('Some contents...');
// Will change the contents all text areas with the class tinymce
$('textarea.tinymce').html('Some contents...');
// Gets the contents from a specific editor
alert($('#someeditor').html());
Try setting it to empty string, might be just what you need.
If you are interested in clearing the content of the editor you can use:
tinymce.get('#editorId').setContent(''); // like others have suggested
However, if you'd like to reset the content and menu buttons etc. - essentially resetting the editor altogether you might consider using:
tinymce.get('#editorId').init();
Sets the specified content to the editor instance, this will cleanup the content before it gets set using
the different cleanup rules options.
tinymce.activeEditor.setContent('');
$('#name_of_your_textarea').val('');

Categories

Resources