CKEditor enable special characters (its stripping them) - ckeditor

Im using CKEditor as a part of Grocery Crud (this is a php codeignihter crud setup), which uses CKEditor (3.6.5) to edit text fields.
So the problem im having is, some special characters (like Ā) gets somewhat stripped from CKEditor (this happens in the latest version too). Can someone help me make sure these special characters gets treated correctly (specially if there is any flags that i can set maybe)?
To test, just open up a CKEditor anywhere (use the Full demo on the CKEditor website), click the "source" button (to see html mode), then paste the following in the editor: Ā. Then click the source button again (to see the wysiwyg mode) and you will see a Letter A with a line above it. Then click the source again (to see html mode) and you will see that the characters you entered Ā have been replaced by the Letter A with the line above it.
Any thoughts about keeping CKEditor from stripping out the character codes?
The above only happens for some special characters (ones that uses decimal or hex codes) and not others which is a bit strange. And some character codes (that uses hex/decimal) get changed to some other codes (that has non hex/decimal alternatives, which is strange but atleast you end up with the same result).

Alright, let me answer my own question.
You need to add the following to the config:
config.entities_processNumerical = true;
In the case of grocery crud, this is done on the following file: /assets/grocery_crud/texteditor/ckeditor/config.js
More doccumentation can be found here: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.entities_processNumerical
To be fair though, im surprised this is not enabled by default. Not quite sure why.

Related

show/hide characters on CKEditor

Can someone help? I've googled it a lot and couldn't find an answer. Is there a way to show/hide non-printable characters on the CKEditor, like there is on word? I couldn't find any plugin for it :/
In short, there is no way to do it or at least it is not easy.
Now the longer version. If you are talking about the Pilcrow character then it is possible to show it in CKEditor by using HTML entities ¶ or ¶ but please note this character is NOT non-printable by any means and in order to make it non-printable you would need to write a code which handles it and this is not easy. First of all you would need write a code (can be done as CKEditor plugin) which inserts Pilcrows on Enter and removes them wherever data is sent to server. So far so good but since this is a normal character (from CKEditor content area POV) you would need to handle all situations in which this character can be removed while typing, styling and modifying entered text and this is next to impossible.
As an alternative you could try having a code which inserts e.g. spans with PilcRow as a background image. While it would be easier to handle spans than plain character you would still need to handle all situations in which this span should or should not be removed while typing, deleting text, styling etc. and again this is very hard to do.

Applescript: Detect double instances

Here's how a text document in Apple Pages might be structured:
CHARACTER #1: Dialogue
CHARACTER #2: Dialogue
CHARACTER #1: Dialogue
Action description.
CHARACTER #1: Dialogue
My question:
Using Applescript, is there a way to detect that the last two dialogue entries stem from the same character, even though there is an action description in between?
CHARACTER names are defined by a paragraph style and always appear in ALL CAPS.
Many thanks for your time!
Disappointingly, the more recent versions of Pages (like 5.5.2, which I have right now) are very limited in AppleScript support. One should be able to access specific properties of paragraphs, including paragraph style (this seemed to be possible in past versions, 5-6 yrs ago), but this is not possible. You'd be better off exporting as an rtf (for example) and using a more complete script-able app -- but guess what? Pages doesn't even support exporting to RTF.
A quick bit of advice: If you do end up exporting as Word document, use the older "doc" version instead of the "docx" (under 'Advanced' setting in export), or at least test between them. docx can kill screenplay-formatted documents (which you seem to be working with).
I'd also suggest that you be more specific with your question, like what the style consists of, and any code you've actually tried (which is considered basic form here on StackOverflow).

Regarding shift + enter with ckeditor inserting invisible character

I am using CK editor 4.4.6.
It seem on the first instance of pressing shift + enter, the editor inserts an invisible character. Upon submission, the character saves as a question mark. I can't see the character in the form submission when viewing the debug in the browser or the source code in the WYSIWYG editor itself. I do however notice when I press the right arrow that the cursor pauses at this character even though I can't see it. The page is being served in UTF-8.
This character is zero-width-space and is used by CKEditor to workaround Safari's and Blink's problems with placing selection inside empty inline tags or around them or in couple of other positions.
However, this character should never end up in data. It's used only internally and it is removed when getting data from editor. So, if you can find it in your database it means that you either get data from editor incorrectly, or you encounter some bug in the mechanism I described. In the latter is true please report a bug on http://dev.ckeditor.com, but please also describe how you reproduce it.
Looks like the editor is inserting character 8203.
What's HTML character code 8203?
I don't want to mess with the editor script at the moment so I'm just stripping out that character in the future on form/ajax post.

Sublime Text autocomplete suggestions looks corrupt, how to fix?

Not sure what is happening to my installation of Sublime Text, when ever autocomplete drop down appears it is populated with a bunch of corrupted looking suggestions, this just started recently. I have Googled around and have not yet seen another person with the same issue. I've already tried uninstalling, throwing out User/me/Library/Application Support/Sublime Text 3 folder, and re-installing, but still the corrupted text shows up in my autocomplete. I am working on a Macbook Air, I also use a Macbook Pro at work with the same setup and have never seen this happen before?
As established in the comments, you have base64-encoded strings (likely an inline image) elsewhere in your file. Sublime's default autocomplete populates its choices menu with elements from your file, and uses fuzzy matching to bring up selections. Since base64 can contain all letters and numbers, chances are that any sequence you're typing may match, and that string will be brought to the top of the autocomplete dropdown.
There are a couple of ways around this. First, if the base64 content is actually scoped as a string (i.e., it's surrounded by single or double quotes), you can add the following line to your settings (Preferences -> Settings-User):
"auto_complete_selector": "source - comment - string, meta.tag - punctuation.definition.tag.begin"
This should hopefully solve your problem for the time being, with the downside that you lose any other string-encoded information that you may wish to be in autocomplete.
You can also try using an autocomplete engine like SublimeCodeIntel (works for multiple languages, including JS) or TernJS. These can have the option of turning off Sublime's internal autocomplete mechanism, and just filling in the choices with their generated content.

Remove spaces from a string of text in clipboard

This is maybe a weird request but hear me out:
I have a huge database at my shop containing product codes, like 87 445 G 6 which I need to check for availability on a supplier's website. The problem is, the supplier's website consists of a web form in which I have to enter the code without spaces, so imagine that I have to manually delete spaces every time I paste a code or write it manually without.
I can't edit the database from which I copy the codes.
I wonder if some sort of plugin, script, or trick can be used directly in browser on the supplier's web form, or some software to modify how the windows clipboard works, maybe some option to copy text without spaces. Using Windows XP.
The OP has probably moved on, but for anyone else looking here, my approach was to tackle this from the windows clipboard side.
For background: I keep a list of my credit card info in Keepass. Sometimes (poorly coded) shopping cart checkout forms don't like spaces in between card numbers. I like storing them with spaces since it's easier to read off that way.
There's various Windows clipboard utilites out there, but it took me a while to find one that could do some processing on the clipboard contents and pasting it out - Clipboard Help and Spell
The program has a way to "save" a bunch of text transformations, and even assign the action to a hotkey.
For reference, my "Find and Replace" action is to find "\s" (without quotes) and leave the Replace textbox empty. "\s" will match whitespace character.
Use the javascript console
You could use the javascript console for your browser to edit the textarea after you paste.
Using Google Chrome (or Firefox)
Paste your text in the text area.
Right click the text area and click Inspect Element
Look at the id for the element
Now switch to the console view
then run these lines (making sure to replace with 'the-id' with your id)
var my_text_area = document.getElementById('the-id'); // Put your id in here
my_text_area.value = my_text_area.value.replace(/ /g,"") // Deletes just spaces
It's even simpler if you have access to jQuery:
$('#the-id').val($('#the-id').val().replace(/ /g, ""))
The replace function is simply using regular expressions to convert spaces to nothing. If you want to replace all whitespace (including newlines) you would use .replace(/\s/g,"").
For firefox, the names are the same but the UI is a little bit different.
Use greasemonkey
You can either write a greasemonkey plugin or try to find one that fits your needs.

Resources