mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Working: Made progress on Rgex Checking
This commit is contained in:
parent
9312e0bfaf
commit
f706dd6763
4 changed files with 31 additions and 45 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,2 +1 @@
|
|||
|
||||
build/squire.js
|
||||
serve.js
|
||||
|
|
2
Makefile
2
Makefile
|
@ -7,7 +7,7 @@ clean:
|
|||
|
||||
ui: build/Squire-UI.html build/Squire-UI.css build/Squire-UI.js fonts
|
||||
|
||||
build: build/ie8.js build/squire.js build/document.html
|
||||
build: build/ie8.js build/squire.js build/document.html ui
|
||||
|
||||
fonts:
|
||||
cp -r ui/assets/font-awesome build
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
<div class="menu" contenteditable="false">
|
||||
<div class="group">
|
||||
<div class="item fa fa-bold" data-action="bold" data-value="" style=
|
||||
"font-style: italic"></div>
|
||||
<div class="item fa fa-bold" data-action="bold" data-value=""></div>
|
||||
|
||||
<div class="item fa fa-italic" data-action="italic" data-value="" style=
|
||||
"font-style: italic"></div>
|
||||
<div class="item fa fa-italic" data-action="italic" data-value="" ></div>
|
||||
|
||||
<div class="item fa fa-underline" data-action="underline" data-value=""
|
||||
style="font-style: italic"></div>
|
||||
></div>
|
||||
|
||||
<div class="item fa fa-font" data-action="" data-value="" id="font"
|
||||
style="font-style: italic"></div>
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div class="group">
|
||||
|
@ -18,13 +16,12 @@
|
|||
"font-style: italic"></div>
|
||||
|
||||
<div class="item fa fa-quote-right" data-action="quote" data-value=""
|
||||
style="font-style: italic"></div>
|
||||
></div>
|
||||
|
||||
<div class="item fa fa-list" data-action="list" data-value="" style=
|
||||
"font-style: italic"></div>
|
||||
<div class="item fa fa-list" data-action="list" data-value="" ></div>
|
||||
|
||||
<div class="item fa fa-picture-o" data-action="image" data-value=""
|
||||
style="font-style: italic"></div>
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div class="group">
|
||||
|
@ -32,15 +29,13 @@
|
|||
"font-style: italic"></div>
|
||||
|
||||
<div class="item fa fa-quote-right" data-action="quote" data-value=""
|
||||
style="font-style: italic"></div>
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div class="group">
|
||||
<div class="item fa fa-undo" data-action="undo" data-value="" style=
|
||||
"font-style: italic"></div>
|
||||
<div class="item fa fa-undo" data-action="undo" data-value=""></div>
|
||||
|
||||
<div class="item fa fa-undo flip" data-action="redo" data-value="" style=
|
||||
"font-style: italic"></div>
|
||||
<div class="item fa fa-undo flip" data-action="redo" data-value="" ></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ function buildPathConCat(value) {
|
|||
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
SquireUI = function(options) {
|
||||
// Create instance of iFrame
|
||||
var container, editor;
|
||||
|
@ -26,7 +27,16 @@ $(document).ready(function () {
|
|||
var div = document.createElement('div');
|
||||
div.className = 'Squire-UI';
|
||||
|
||||
$(div).load(buildPath + 'Squire-UI.html', this.menuAction);
|
||||
$(div).load(buildPath + 'Squire-UI.html', function() {
|
||||
$('.item').click(function() {
|
||||
var me = $(this);
|
||||
var iFrame = me.parents('.Squire-UI').next('iframe').first()[0];
|
||||
var editor = iFrame.contentWindow.editor;
|
||||
console.log(SquireUI.isBold(editor));
|
||||
|
||||
editor[me.data('action')](me.data('value'));
|
||||
});
|
||||
});
|
||||
|
||||
$(container).append(div);
|
||||
$(container).append(iframe);
|
||||
|
@ -35,31 +45,13 @@ $(document).ready(function () {
|
|||
return iframe.contentWindow.editor;
|
||||
};
|
||||
|
||||
SquireUI.menuAction = function() {
|
||||
$('.item').click(function() {
|
||||
var me = $(this);
|
||||
var iFrame = me.parents('.Squire-UI').next('iframe').first()[0];
|
||||
var editor = iFrame.contentWindow.editor;
|
||||
try {
|
||||
editor[me.data('action')](me.data('value'));
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
SquireUI.isBold = function (editor) { return this.isPresent( 'B', ( />B\b/ ), editor ); };
|
||||
SquireUI.isItalic = function (editor) { return isPresent( 'I', ( />I\b/ ), editor ); };
|
||||
SquireUI.isUnderlined = function (editor) { return isPresent( 'U', ( />U\b/ ), editor); };
|
||||
SquireUI.isStriked = function (editor) { return isPresent( 'S', ( />S\b/ ), editor ); };
|
||||
SquireUI.isLink = function (editor) { return isPresent( 'A', ( />A\b/ ), editor ); };
|
||||
SquireUI.isPresent = function (format, validation, editor) {
|
||||
var path = editor.getPath();
|
||||
return validation.test(path);
|
||||
};
|
||||
|
||||
SquireUI.isBold = function (editor) { isPresent( 'B', ( />B\b/ ), editor ) };
|
||||
SquireUI.isItalic = function (editor) { isPresent( 'I', ( />I\b/ ) );
|
||||
SquireUI.isUnderlined = function (editor) { isPresent( 'U', ( />U\b/ ) );
|
||||
SquireUI.isStriked = function (editor) { isPresent( 'S', ( />S\b/ ) );
|
||||
SquireUI.isLink = isPresent( 'A', ( />A\b/ ) );
|
||||
SquireUI.isPresent = function () {
|
||||
editor.getPath()
|
||||
};
|
||||
|
||||
SquireUI.whenTextSelected = function () {
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
Loading…
Reference in a new issue