Sha256: 903ef7f66d498b7025a4d674fdd75e413c98efde94c6e3ef7bf7e1eaea30b54a

Contents?: true

Size: 1.01 KB

Versions: 15

Compression:

Stored size: 1.01 KB

Contents

(function(punymce) {
	function insertAfter(n, r) {
		var p, ns;

		p = r.parentNode;
		ns = r.nextSibling;

		if (ns)
			p.insertBefore(n, ns);
		else
			p.appendChild(n);

		return n;
	};

	punymce.plugins.TabFocus = function(ed) {
		var Event = punymce.Event, DOM = punymce.DOM;

		ed.onInit.add(function() {
			var p, ns, n;

			// Append an anchor element after the editor container ones this gets focused it will
			// focus the editor instead this makes it possible to shift tab into the editor
			n = insertAfter(DOM.create('a', {href : '#'}), DOM.get(ed.settings.id + '_c'));

			Event.add(n, 'focus', function(e) {
				ed.getWin().focus();
			});

			Event.add(ed.getDoc(), 'keydown', function(e) {
				if (e.keyCode == 9)
					return Event.cancel(e);
			});

			Event.add(ed.getDoc(), 'keydown', function(e) {
				if (e.keyCode == 9) {
					window.focus();

					// Focus the specified element
					DOM.get(ed.settings.tabfocus_id).focus();
				}
			});
		});
	};
})(punymce);

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
radiant-forum-extension-2.1.6 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.1.4 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.1.3 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.1.2 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.1.1 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.0.9 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.0.8 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.0.7 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.0.6 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.0.5 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.0.4 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.0.3 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.0.2 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.0.1 public/punymce/plugins/tabfocus_src.js
radiant-forum-extension-2.0.0 public/punymce/plugins/tabfocus_src.js