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 @@
|
||||||
|
serve.js
|
||||||
build/squire.js
|
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -7,7 +7,7 @@ clean:
|
||||||
|
|
||||||
ui: build/Squire-UI.html build/Squire-UI.css build/Squire-UI.js fonts
|
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:
|
fonts:
|
||||||
cp -r ui/assets/font-awesome build
|
cp -r ui/assets/font-awesome build
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
<div class="menu" contenteditable="false">
|
<div class="menu" contenteditable="false">
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<div class="item fa fa-bold" data-action="bold" data-value="" style=
|
<div class="item fa fa-bold" data-action="bold" data-value=""></div>
|
||||||
"font-style: italic"></div>
|
|
||||||
|
|
||||||
<div class="item fa fa-italic" data-action="italic" data-value="" style=
|
<div class="item fa fa-italic" data-action="italic" data-value="" ></div>
|
||||||
"font-style: italic"></div>
|
|
||||||
|
|
||||||
<div class="item fa fa-underline" data-action="underline" data-value=""
|
<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"
|
<div class="item fa fa-font" data-action="" data-value="" id="font"
|
||||||
style="font-style: italic"></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="group">
|
<div class="group">
|
||||||
|
@ -18,13 +16,12 @@
|
||||||
"font-style: italic"></div>
|
"font-style: italic"></div>
|
||||||
|
|
||||||
<div class="item fa fa-quote-right" data-action="quote" data-value=""
|
<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=
|
<div class="item fa fa-list" data-action="list" data-value="" ></div>
|
||||||
"font-style: italic"></div>
|
|
||||||
|
|
||||||
<div class="item fa fa-picture-o" data-action="image" data-value=""
|
<div class="item fa fa-picture-o" data-action="image" data-value=""
|
||||||
style="font-style: italic"></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="group">
|
<div class="group">
|
||||||
|
@ -32,15 +29,13 @@
|
||||||
"font-style: italic"></div>
|
"font-style: italic"></div>
|
||||||
|
|
||||||
<div class="item fa fa-quote-right" data-action="quote" data-value=""
|
<div class="item fa fa-quote-right" data-action="quote" data-value=""
|
||||||
style="font-style: italic"></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<div class="item fa fa-undo" data-action="undo" data-value="" style=
|
<div class="item fa fa-undo" data-action="undo" data-value=""></div>
|
||||||
"font-style: italic"></div>
|
|
||||||
|
|
||||||
<div class="item fa fa-undo flip" data-action="redo" data-value="" style=
|
<div class="item fa fa-undo flip" data-action="redo" data-value="" ></div>
|
||||||
"font-style: italic"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ function buildPathConCat(value) {
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
SquireUI = function(options) {
|
SquireUI = function(options) {
|
||||||
// Create instance of iFrame
|
// Create instance of iFrame
|
||||||
var container, editor;
|
var container, editor;
|
||||||
|
@ -26,7 +27,16 @@ $(document).ready(function () {
|
||||||
var div = document.createElement('div');
|
var div = document.createElement('div');
|
||||||
div.className = 'Squire-UI';
|
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(div);
|
||||||
$(container).append(iframe);
|
$(container).append(iframe);
|
||||||
|
@ -35,31 +45,13 @@ $(document).ready(function () {
|
||||||
return iframe.contentWindow.editor;
|
return iframe.contentWindow.editor;
|
||||||
};
|
};
|
||||||
|
|
||||||
SquireUI.menuAction = function() {
|
SquireUI.isBold = function (editor) { return this.isPresent( 'B', ( />B\b/ ), editor ); };
|
||||||
$('.item').click(function() {
|
SquireUI.isItalic = function (editor) { return isPresent( 'I', ( />I\b/ ), editor ); };
|
||||||
var me = $(this);
|
SquireUI.isUnderlined = function (editor) { return isPresent( 'U', ( />U\b/ ), editor); };
|
||||||
var iFrame = me.parents('.Squire-UI').next('iframe').first()[0];
|
SquireUI.isStriked = function (editor) { return isPresent( 'S', ( />S\b/ ), editor ); };
|
||||||
var editor = iFrame.contentWindow.editor;
|
SquireUI.isLink = function (editor) { return isPresent( 'A', ( />A\b/ ), editor ); };
|
||||||
try {
|
SquireUI.isPresent = function (format, validation, editor) {
|
||||||
editor[me.data('action')](me.data('value'));
|
var path = editor.getPath();
|
||||||
} catch (error) {
|
return validation.test(path);
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
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