0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Lists now work on no selected text

This commit is contained in:
Matthew Borden 2014-07-11 00:29:49 +10:00
parent 8e1b30b2ad
commit d06a3831b7
2 changed files with 38 additions and 11 deletions

View file

@ -23,21 +23,32 @@
</div>
<div class="templates hidden">
<div id="drop-font">
<i class="fa fa-chevron-up quit"></i>
<strong>Insert Link</strong>
<i class="fa fa-chevron-up quit"></i><br>
Text Size: <input type="number" min="12" max="72" step="6" value="12" name="font-size">
<br>
Font: <input type="text">
Font:
<select>
<option data-fonts="georgia, serif">Georgia</option>
<option data-fonts="arial, sans-serif">Arial</option>
<option data-fonts="helvetica, arial, sans-serif">Helvetica</option>
<option data-fonts="menlo, consolas, courier new, monospace">Monospace</option>
<option data-fonts="\"Times New Roman\", times, serif">Times New Roman</option>
<option data-fonts="tahoma, sans-serif">Tahoma</option>
<option data-fonts="\"Trebuchet MS\", sans-serif ">Trebuchet MS</option>
<option data-fonts="verdana, sans-serif">Verdana</option>
</select>
</div>
<div id="drop-link">
<label>Insert Link</label>
<strong>Insert Link</strong>
<i class="fa fa-chevron-up quit"></i>
<input value="http://" type="text" id="url" />
<input placeholder="Link URL" type="text" id="url" />
<div class="btn submitLink">Insert</div>
</div>
<div id="drop-image">
<label>Insert Image</label>
<strong>Insert Image</strong>
<i class="fa fa-chevron-up quit"></i>
<input value="http://" placeholder="Image URL" type="text" id="imageUrl" />
<input placeholder="Image URL" type="text" id="imageUrl" />
<div class="btn sumbitImageURL">Insert</div>
</div>
</div>

View file

@ -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]();
}
});
});