From d06a3831b73428b69ade537f23e738fbf880f855 Mon Sep 17 00:00:00 2001 From: Matthew Borden Date: Fri, 11 Jul 2014 00:29:49 +1000 Subject: [PATCH] Lists now work on no selected text --- ui/Squire-UI.html | 23 +++++++++++++++++------ ui/Squire-UI.js | 26 +++++++++++++++++++++----- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/ui/Squire-UI.html b/ui/Squire-UI.html index b04a3b6..eeba52a 100644 --- a/ui/Squire-UI.html +++ b/ui/Squire-UI.html @@ -23,21 +23,32 @@ diff --git a/ui/Squire-UI.js b/ui/Squire-UI.js index 7b76862..0e9417b 100644 --- a/ui/Squire-UI.js +++ b/ui/Squire-UI.js @@ -66,7 +66,7 @@ $(document).ready(function() { $('.quit').unbind().click(function () { $(this).parent().parent().removeClass('drop-open'); }); - + $('.sumbitImageURL').unbind().click(function () { console.log("Passed through .sumbitImageURL"); editor = iframe.contentWindow.editor; @@ -75,6 +75,24 @@ $(document).ready(function() { $(this).parent().parent().removeClass('drop-open'); $(this).parent().children('#imageUrl').attr('value', ''); }); + + }); + + this.fontDrop = new Drop({ + target: $('#selectFont').first()[0], + content: $('#drop-font').html(), + position: 'bottom center', + openOn: 'click' + }); + + this.fontDrop.on('open', function () { + $('.quit').unbind().click(function () { + $(this).parent().parent().removeClass('drop-open'); + }); + + $('.sumbitImageURL').unbind().click(function () { + + }); }); $('.item').click(function() { @@ -82,8 +100,6 @@ $(document).ready(function() { var editor = iframe.contentWindow.editor; var action = $(this).data('action'); - if (editor.getSelectedText() === '' && action != 'insertImage') return 0; - test = { value: $(this).data('action'), testBold: editor.testPresenceinSelection('bold', @@ -114,8 +130,8 @@ $(document).ready(function() { } else if (test.isNotValue('makeLink') | test.isNotValue('insertImage') | test.isNotValue('selectFont')) { // do nothing these are dropdowns. } else { - console.log($(this).data('action')); - editor[$(this).data('action')](); + if (editor.getSelectedText() === '' && (action == 'insertImage' || action == 'makeOrderedList' || action == 'increaseQuoteLevel') == false) return; + editor[action](); } }); });