Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
5ee43a60
Commit
5ee43a60
authored
Mar 17, 2014
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bootstrap-wysiwyg: fixed font menu
parent
f92987b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
7 deletions
+48
-7
src/js/gadget_bootstrap_wysiwyg.js
src/js/gadget_bootstrap_wysiwyg.js
+48
-7
No files found.
src/js/gadget_bootstrap_wysiwyg.js
View file @
5ee43a60
...
...
@@ -4,24 +4,65 @@
(
function
(
window
,
$
,
rJS
)
{
function
initToolbarBootstrapBindings
()
{
var
fonts
=
[
'
Serif
'
,
'
Sans
'
,
'
Arial
'
,
'
Arial Black
'
,
'
Courier
'
,
'
Courier New
'
,
'
Comic Sans MS
'
,
'
Helvetica
'
,
'
Impact
'
,
'
Lucida Grande
'
,
'
Lucida Sans
'
,
'
Tahoma
'
,
'
Times
'
,
'
Times New Roman
'
,
'
Verdana
'
],
fontTarget
=
$
(
'
[title=Font]
'
).
siblings
(
'
.dropdown-menu
'
);
$
.
each
(
fonts
,
function
(
idx
,
fontName
)
{
/*jslint unparam: true */
fontTarget
.
append
(
$
(
'
<li><a data-edit="fontName
'
+
fontName
+
'
" style="font-family:
\'
'
+
fontName
+
'
\'
">
'
+
fontName
+
'
</a></li>
'
));
});
$
(
'
.dropdown-menu input
'
).
click
(
function
()
{
return
false
;
}).
change
(
function
()
{
$
(
this
).
parent
(
'
.dropdown-menu
'
).
siblings
(
'
.dropdown-toggle
'
).
dropdown
(
'
toggle
'
);
}).
keydown
(
'
esc
'
,
function
()
{
this
.
value
=
''
;
$
(
this
).
change
();
});
$
(
'
[data-role=magic-overlay]
'
).
each
(
function
()
{
var
overlay
=
$
(
this
),
target
=
$
(
overlay
.
data
(
'
target
'
));
overlay
.
css
(
'
opacity
'
,
0
).
css
(
'
position
'
,
'
absolute
'
).
offset
(
target
.
offset
()).
width
(
target
.
outerWidth
()).
height
(
target
.
outerHeight
());
});
}
function
showErrorAlert
(
reason
,
detail
)
{
var
msg
=
''
;
if
(
reason
===
'
unsupported-file-type
'
)
{
msg
=
"
Unsupported format
"
+
detail
;
}
else
{
console
.
log
(
"
error uploading file
"
,
reason
,
detail
);
}
$
(
'
<div class="alert"> <button type="button" class="close" data-dismiss="alert">×</button>
'
+
'
<strong>File upload error</strong>
'
+
msg
+
'
</div>
'
).
prependTo
(
'
#alerts
'
);
}
function
init
()
{
this
.
editor
=
$
(
'
#editor
'
);
this
.
editor
.
wysiwyg
();
initToolbarBootstrapBindings
();
this
.
editor
.
wysiwyg
({
fileUploadError
:
showErrorAlert
});
}
rJS
(
window
).
declareMethod
(
'
getContent
'
,
function
()
{
return
rJS
(
this
).
editor
.
html
();
})
rJS
(
window
).
declareMethod
(
'
getContent
'
,
function
()
{
return
rJS
(
this
).
editor
.
html
();
})
.
declareMethod
(
'
setContent
'
,
function
(
content
)
{
//console.log('setcontent:' + content);
rJS
(
this
).
editor
.
html
(
content
);
})
.
declareMethod
(
'
clearContent
'
,
function
()
{
rJS
(
this
).
editor
.
html
(
''
);
})
.
ready
(
function
(
g
)
{
init
.
apply
(
g
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment