connection symbols in wordpress - wordpress

I want to add some javascript in wordpress, something like
if(iNum==0&&iNum+1!=l)
It shows up wrong, in the source code I found & became & how do I solve it? Thanks.
if(iNum==0&\& iNum+1!=l)

Where did you put that code?
To insert arbitrary javascript code, you need to use HTML mode in post / page edit window.
To do that, just click on 'HTML' just above editor window (to the right of Upload/Insert tools)

Related

TinyMCE Wordpress wpview 'gallery' after drag & drop

sorry for the title, but it is hard to describe my problem/ question in a short sentence or title.
So here is my story:
I am writing a WP plugin, which replaces the original [gallery] shortcode. For having a correct "preview" in visual editor (TinyMCE), I also slightly modified (by replacing it) the wpview plugin. But just small changes, like removing the 'Remove' button from the inline toolbar.
All works pretty well so far. One can switch between HTML and Visual mode. The [gallery] shortcode is replaced with the HTML output in Visual mode.
The only thing/ problem is, that if one selects a gallery view and drags it around, it becomes the (original) element (with the [gallery] shortcode).
I have really no idea why and where this happens!?
So my first question is, if anyone has an idea?
Searching for a solution/ workaround for this issue, I would also like to know, if there is an event fired, when a drag & drop action ends in WP TinyMCE?
I realized, that for a drag & drop action TinyMCE appends a element with class attribute "mce-drag-container". Maybe I have to monitor the iframe document for the existence of this element (to call a function when it is removed)?
Any ideas, tips or hints for this?
The last option I could think of would be to make the wp gallery views non-draggable.
Unfortunately I could not find any information on how to do it. If it is possible in the end?
So if anyone has a clue ...?
Any help is very much appreciated.
Many thanks in advance.
Greetings
Gunther
Have you tried listening for a general content change and checking if it's a dragged image?
All TinyMCE editor events can be found in the docs: https://www.tinymce.com/docs/advanced/events/
OK, after some further investigation I found the function that caused my "problem".
It is the following (in wpview:
// Make sure views are copied as their text.
editor.on( 'drop objectselected', function( event ) {
if ( isView( event.targetClone ) ) {
event.targetClone = editor.getDoc().createTextNode(
window.decodeURIComponent( editor.dom.getAttrib( event.targetClone, 'data-wpview-text' ) )
);
}
} );
In my case this is an "unwanted behaviour", as I wanted the view to stay intact/ as is.
So the solution (in my case) is just to delete/ do not use this event/ function.

atom.io auto create html basic structure

Im using atom.io for some time now and really like it. there is just one thing im missing. I used to use brackets and sublime before and they both had a feature where you could create the basic structure of a html documents by just typing html.
this would just set the html, head and body tag. created the charset meta, title and link to css file.
I create a lot of html files a day so it would be really helpfull if I know the shortcode or the package which supports this!
You're looking for autocomplete-snippets.
Simply type html and press Enter
Here's a terrible GIF to prove it:
There is a nice Plugin, called emmet: https://atom.io/packages/emmet
When you got that, you just have to type ! -> tab in an empty document. You get pretty much the same result as #hatchet GIF.
If you have disabled the autocomplete functionality mentioned in the currently accepted answer, or want more flexibility than that allows, there is a file-templates package:
https://atom.io/packages/file-templates
Here are some basic instructions.
To install the package: edit->preferences->install->file-templates.
To save the template: packages->new template from this file.
To open a new file with that template, just hit ctrl-alt-n and
select it.
Make sure your file has .html added on the end of its name.
Then go back into Atom, type HTML, and press enter. Your boilerplate should appear. Solved my problem instantly!
If we install Emmet package we are not getting the boiler plate code. So I disabled emmet and it is working fine for me.
!tab is the command u seek. But it won't work unless you create a file and save it with the html extension...
So go create a new file in the directory u want, call it index.html and now go type !tab
It should work 100%, if not be sure u have emmet installed.

ModX - embedded iframe disappears

I have a YouTube video embedded on a page in ModX. To place it, on the Page I switch TinyMCE off to reveal the HTML code then paste the iframe in. That works Ok but when I go back to edit something else in HTML mode the iframe code disappears.
Anyone know whats going on?
TinyMce is encoding some of the characters in your youtube code for you... it honestly thinks it is being helpful ;) . You have 3 options:
Reference the tinymce documentation, there are some options to tell it which characters not to encode. [sorry, don't remember offhand what they are]
turn off "rich text" on the particular resource you are trying to include the video in.
place your video code in a chunk & reference that chunk in your resource instead of the actual code. [probably your best bet]

Wordpress Plug-In for Documents Library

I need a very easy to use plug-in which will help me have this effect in Wordpress. Please note that simple page editing is not working -- add text and set hyperlink (this is not working). We need PDF & PPT files for now, however if there is a solution with wider variety of file type it would be great.
Please see the below reference hyperlink for more visual explanation - TAB "Manuals" (I do not need the tabs, justthe list):-
http://support.lexmark.com/index?segment=SUPPORT&userlocale=EN_US&locale=en&productCode=LEXMARK_C524&page=product&frompage=null#5
You can try http://wordpress.org/extend/plugins/document-library/

What is the use of firebug's "Open With Editor" function?

What is the use of firebug's "Open With Editor" function?
I'd say it'll allow you to visualize a file / feed with an editor -- which means better searching features, syntax-highlighting, better-ability to copy code...
But it means you have to configure the editors, so firebug knows how to call one -- especially, so it knows how to pass it the data.
Edit after the comment : no, I don't see it allows you to see your modifications into the website -- but it's, I think, easier to go through the HTML code this way, with the editor you're using in your every-day life as a developer.
For example, you can check what's said in this article : Check Edit HTML Code with Firebug -- check the Editing With Firebug section.
And to use it, you have to :
select something like "Open with editor > Configure editors", and, in the dialog box, set the path to your editor
and, then, to edit some HTML page, select "Open with editor > name of your editor"
(The labels may not be exactly those : I'm using the french version...)
You can use cssUpdater to save your modified css directly after you have changed the property in FireBug -> http://www.cssUpdater.com

Resources