CKEditor Plugin: text fields not editable - plugins

I am creating a CKEditor plugin, using version 4.2.1. I am trying to follow the tutorial on a Simple Plugin. However, the text inputs in my dialog window are not editable / clickable in the dialog, even when I just copy in the entire abbr plugin from the tutorial with no changes.
I can still click the dialog tabs, OK / Cancel buttons, and drag the dialog around. I have added in other elements (like selects) to the dialog in my custom version, and I can interact with those.
When I check the text input elements in Chrome's Dev Tools, I can add text via the Console / jQuery and it appears. I get no failures in the Console.
$('#cke_229_textInput').val('help');
Will add text to the text input and display it on the screen. But I can't interact with the element via mouse / keyboard / browser. Is there something obvious in the CKEditor configuration that I am missing? Sorry if this is a really stupid question--first time working with CKEditor. I have also searched the CKEditor forums and Google, without finding any related issues.
This happens in both Chrome 30 and FF 24.
My call to create the editor:
var me = document.getElementById('resource_editor_raw');
editor = CKEDITOR.replace(me, {
fullPage: true,
removePlugins: 'newpage,forms,templates',
extraPlugins: 'abbr',
allowedContent: true
});
Thanks for any tips or hints!
Update #1
Thinking this might be related, I have also tried setting the z-index of the text element to very high, using Chrome's Dev Tools. No luck, it is still not editable / highlightable...
Update #2
This seems to be this conflict with jQuery UI. The suggested fix doesn't work for me yet, but will poke around...leaving this up for anyone who might stumble across it.
Final Update
So Brian's tip helped me. Both the Bootbox modal backdrop (what I am using to generate the original dialog) and the CKEditor dialog backdrop have tabindex=-1, so they conflict somehow. Manually turning off the Bootbox backdrop (i.e. setting tabindex='') works with Chrome dev tools, so I think I can hack something together with jQuery or whatnot. Amazing stuff...thanks for the help!! Not sure why I got this working in a jsFiddle...if I recall correctly, I might not have had a backdrop on those dialogs.
Also, for reference, a tabindex of -1 makes things untabbable, which makes sense for a backdrop.

The modal html attribute tabindex='-1' is what seems to be causing the issues for me.
The tabindex='-1' is actually in the bootstrap documentation and is needed for some reason that I am unaware of.

Use the 100% working script..
<script type="text/javascript">
// Include this file AFTER both jQuery and bootstrap are loaded.
$.fn.modal.Constructor.prototype.enforceFocus = function() {
modal_this = this
$(document).on('focusin.modal', function (e) {
if (modal_this.$element[0] !== e.target && !modal_this.$element.has(e.target).length
&& !$(e.target.parentNode).hasClass('cke_dialog_ui_input_select')
&& !$(e.target.parentNode).hasClass('cke_dialog_ui_input_textarea')
&& !$(e.target.parentNode).hasClass('cke_dialog_ui_input_text')) {
modal_this.$element.focus()
}
})
};
</script>
Note: Include this file after both jQuery and bootstrap are loaded.

OMG I have been googling this for hours and finally fond some code that works!!
Stick this in your dialog page that will have a ckeditor in it:
orig_allowInteraction = $.ui.dialog.prototype._allowInteraction;
$.ui.dialog.prototype._allowInteraction = function(event) {
if ($(event.target).closest('.cke_dialog').length) {
return true;
}
return orig_allowInteraction.apply(this, arguments);
};
I found the fix here:
https://forum.jquery.com/topic/can-t-edit-fields-of-ckeditor-in-jquery-ui-modal-dialog

Not sure if anyone else is having this issue now. I was ripping my hair out trying to create a hack. It was a pretty simple solution after a while of digging and search the web. This fix helped me. Just place it on the same page where you want to place your editor - when loading from jQuery. The issue is conflicting tabindex, so I simply removed that attribute from the modal.
<script>
$(function(){
// APPLY THE EDITOR TO THE TEXTAREA
$(".wysiwyg").ckeditor();
// FIXING THE MODAL/CKEDITOR ISSUE
$(".modal").removeAttr("tabindex");
});
</script>

I am using Semantic UI and fix this problem by create an instance of CKEDITOR after create Modal.
$('#modal-send').modal('attach events', '.btn-close-modal').modal('show');
var ckeOptions = {
entities: false,
htmlEncodeOutput: false,
htmlDecodeOutput: true
}
CKEDITOR.replace('message', ckeOptions);
CKEDITOR.config.extraPlugins = 'justify';

I also faced this issue when I updated the CKEditor into 4.14
I found the fix in here - http://jsfiddle.net/kamelkev/HU8Qt/3/
In this case,
$.widget("ui.dialog", $.ui.dialog, {
_allowInteraction: function (event) {
return !!$(event.target).closest(".cke").length || this._super(event);
}
});
It will return false, so the textbox gets disabled/ unfocused (losing focus)
As a solution, we need to return true or need to modify the class .cke in the return statement into .cke_dialog
return !!$(event.target).closest(".cke").length || this._super(event);

I tried to upload images to server from CK Editor[without CKFinder] and on positive side i am able to do. whenever we are trying to create some dialog, they are creating one div on the fly which will hold your dialog box. Better you check the CSS property for your text box using chrome and change it. Hope this will help you.

Related

ag-grid context menu is cut off (clipped)

Having a ag-grid (Angular component) of ag-grid v8.20
Unfortunately the context menu is clipped if it is bigger than the grid:
(screenshot should be here but I can't upload it, imgur bug?)
Is there a way to make the context menu display completely, without clipping?
If anyone else comes across this post, here is a plunker to demonstrate the fix.
var gridOptions = {
...
popupParent: document.querySelector("body")
...
};
It was clipped because of a CSS style I set on my component.
In my case it was a flexbox with "overflow-y: auto".
I had to remove that to make it work.
This is a general answer for people facing the same issue in react and typescript. This works for me.
popupParent={document.querySelector('body') || undefined}

ionic header bar disappears after reloading the state in angularjs

I am working on a project where I need to use a messaging system.
I have an inbox: When I used the $state.reload() to show the newly sent message but when the state gets reloaded the header bar gets disappeared and doesn't gets visible until i do the manual refresh. I am using ionic 1.1.1 version
I searched a lot but didn't get any suitable reason that why it is happening. Kindly suggest me on this.
So, after searching a lot for ways to solve this problem, that I am also stuck on, I found out there is not! Unfortunatelly updating to the new version of Ionic did not help, and the workaround provided at Ionic's GitHub desn't work for me. It is:
$scope.$on('$ionicView.enter', function(e) {
$ionicNavBarDelegate.showBar(true);
});
But if you have custom buttons in your header, this code doesn't work as expected. There are some jQuery solutions too, but I think it's not what we really need.
Source: https://github.com/driftyco/ionic/issues/3852
EDIT
So, I've worked on a pure Javascript solution, for my situation, and here it is. Hope it can help.
$scope.$on('$ionicView.enter', function(e) {
$timeout(function() {
showHeader();
}, 1000);
function showHeader() {
// Having the nav-bar in your template, set an ID to it.
var header = document.getElementById('header_id');
if (header.classList) {
if (header.classList.contains('hide')) {
header.classList.remove('hide');
}
}
}
});
For me what was causing that issue came from the solution of this problem:
https://github.com/ionic-team/ionic-v1/issues/119
Once i removed this line:
$ionicConfigProvider.views.maxCache(0);
from my config phase the action bar started to work again.

TinyMCE: How do I prevent `<br data-mce-bogus="1">` text in editor?

I have a page with several TinyMCE (v4) editors, which all work great ... until I try and add:
inline: true
to their configuration. When I do that the inline-ing part works great (the toolbar is gone, then appears when I focus the editor), but for some strange reason the editor stops working at that point. Inside the editor I see:
<br data-mce-bogus="1">
but I can't edit that text, or add new text, or do anything at all really with the editor.
I can make the editor work again if I remove inline: true, but I really want the inline effect. Does anyone have any idea how I can get inline without breaking my editors?
Actually, the "bogus" br tags appear for inline divs, too. They are added whenever the input field is empty. There appears to be no easy way to get rid of them. I use a CSS rule during the preview phase:
br[data-mce-bogus="1"] {
display:none;
}
And then strip them out if they make it to the server when the user tries to save.
I recently had this problem, inline: true would not work with a textarea. I change mine to a div and it now works as expected.
Are you using the tinymce jQuery package? The same thing was happening to me until I tried using the normal tinymce package instead.
<script>
$(document).ready(function () {
$("#comment").ready(function () {
$("#comment").val("")
})
})
</script>
I add this jquery script in html to solve this bug.
Add this snippet to your CSS file. That would prevent video bogus.
[data-mce-bogus="all"] {
display:none;
}

TinyMCE content not being updated when using hide

First of all, this is not about the tinyMCE.triggerSave();
Sometimes when editing content, I switch to the textarea mode with the following
$('#id').tinymce().hide(); // from the official example
which temporarily hides the rich editor from view so I can see the HTML codes.
But if I submit the form right after editing without switching back to rich editor [ using .show() ], the content will not be updated.
My question is how can I save the content of textarea to iframe?
Please do not offer me the "use the code window" option, I have a customized show/hide button outside of TinyMCE.
Switching by mceAddControl/mceRemoveControl will solve the problem. But when submitting, the content inside the textarea will not be formatted.
Well, I just figured out a way to update content
$('#id').blur(function() {
$('#id').html(document.getElementById('id').value);
});
UPDATE
this might be even better, for all instances
$('textarea.tinymce').blur(function() {
var this_id = $(this).attr('id');
$('#' + this_id).html(document.getElementById(this_id).value);
});
Any other solutions are really appreciated.

Jqueryui autocomplete, textbox value disappears in IE only when selected

I have an issue where I am using Jqueryui autocomplete. The auto-suggest feature works fine, however, when you click to select one of the items in the list the textbox value is deleted and the list disappears, rendering the autocomplete useless.
I cna only assume its conflicting with something else on the page but I am stumped on this and wonder if anyone can help?
This functions correctly in Firefox and Chrome but in IE it does not.
The issue is occurring on this page: http://www.norfolktastesgood.com/
Thanks in advance.
Possibly the onClick="this.value='';" attribute on line 83 called cause of bubbling????
try adding an event handler to the input, remove the onclick attribute to test
$( "#LocationSearch" ).autocomplete({
source: SearchList
}).click( function(e){
if ( $(e.target).is('#LocationSearch'){
$(this).val('');
}
});
I'm on a linux machine so can't test this at the minute
Hope it works, let me know