diff options
author | Szymon Olewniczak <szymon.olewniczak@rid.pl> | 2014-02-07 17:59:24 +0100 |
---|---|---|
committer | Szymon Olewniczak <szymon.olewniczak@rid.pl> | 2014-02-07 17:59:24 +0100 |
commit | 8af71b8cc80c9e5a62803443c04acd24ba725e42 (patch) | |
tree | 70dcdff3b8b68444c131877629bce364466479f5 /lib/scripts | |
parent | 2bc9e7932fca7046e932dc3722bc3f949e086e94 (diff) | |
download | rpg-8af71b8cc80c9e5a62803443c04acd24ba725e42.tar.gz rpg-8af71b8cc80c9e5a62803443c04acd24ba725e42.tar.bz2 |
add preventDefault to toolbar buttons
Diffstat (limited to 'lib/scripts')
-rw-r--r-- | lib/scripts/edit.js | 11 | ||||
-rw-r--r-- | lib/scripts/toolbar.js | 8 |
2 files changed, 12 insertions, 7 deletions
diff --git a/lib/scripts/edit.js b/lib/scripts/edit.js index 56c185db7..2400103e1 100644 --- a/lib/scripts/edit.js +++ b/lib/scripts/edit.js @@ -134,7 +134,10 @@ function pickerInsert(text,edid){ */ function addBtnActionSignature($btn, props, edid) { if(typeof SIG != 'undefined' && SIG != ''){ - $btn.bind('click', bind(insertAtCarret,edid,SIG)); + $btn.bind('click', function (e) { + insertAtCarret(edid,SIG); + e.preventDefault(); + }); return edid; } return ''; @@ -148,7 +151,7 @@ function addBtnActionSignature($btn, props, edid) { function currentHeadlineLevel(textboxId){ var field = jQuery('#' + textboxId)[0], s = false, - opts = [field.value.substr(0,DWgetSelection(field).start)]; + opts = [field.value.substr(0,getSelection(field).start)]; if (field.form.prefix) { // we need to look in prefix context opts.push(field.form.prefix.value); @@ -217,10 +220,10 @@ jQuery(function () { } // set focus and place cursor at the start - var sel = DWgetSelection($edit_text[0]); + var sel = getSelection($edit_text[0]); sel.start = 0; sel.end = 0; - DWsetSelection(sel); + setSelection(sel); $edit_text.focus(); } diff --git a/lib/scripts/toolbar.js b/lib/scripts/toolbar.js index 09c374bc4..47f5c0df7 100644 --- a/lib/scripts/toolbar.js +++ b/lib/scripts/toolbar.js @@ -101,7 +101,7 @@ function tb_format(btn, props, edid) { function tb_formatln(btn, props, edid) { var sample = props.sample || props.title, opts, - selection = DWgetSelection(jQuery('#'+edid)[0]); + selection = getSelection(jQuery('#'+edid)[0]); sample = fixtxt(sample); props.open = fixtxt(props.open); @@ -199,8 +199,9 @@ function addBtnActionPicker($btn, props, edid) { jQuery(picker).attr('aria-hidden', 'true'); $btn.click( - function() { + function(e) { pickerToggle(pickerid,$btn); + e.preventDefault(); return ''; } ); @@ -219,9 +220,10 @@ function addBtnActionPicker($btn, props, edid) { */ function addBtnActionLinkwiz($btn, props, edid) { dw_linkwiz.init(jQuery('#'+edid)); - jQuery($btn).click(function(){ + jQuery($btn).click(function(e){ dw_linkwiz.val = props; dw_linkwiz.toggle(); + e.preventDefault(); return ''; }); return 'link__wiz'; |