mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-12-26 12:18:21 +01:00
1st working version, annotation is still not work correctly
This commit is contained in:
parent
890dd4b4d1
commit
e72f48d424
BIN
OpenPage/assets/blank.odt
Normal file
BIN
OpenPage/assets/blank.odt
Normal file
Binary file not shown.
BIN
OpenPage/build/debug/blank.odt
Normal file
BIN
OpenPage/build/debug/blank.odt
Normal file
Binary file not shown.
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
@namespace office url(urn:oasis:names:tc:opendocument:xmlns:office:1.0);
|
||||||
afx-app-window[data-id="OpenPage"] div[data-id="container"]
|
afx-app-window[data-id="OpenPage"] div[data-id="container"]
|
||||||
{
|
{
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
@ -8,13 +9,41 @@ afx-app-window[data-id="OpenPage"] div[data-id="container"]
|
|||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background-color: #f2f1f0;
|
background-color: #f2f1f0;
|
||||||
|
/*position: relative;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@media screen, print, handheld, projection
|
||||||
|
{
|
||||||
|
office|body{
|
||||||
|
display: inline !important;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Fix annotation problem not showing
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
afx-app-window[data-id="OpenPage"] document, afx-app-window[data-id="OpenPage"] office:body{
|
||||||
|
display: inline !important;
|
||||||
|
}
|
||||||
|
afx-app-window[data-id="OpenPage"] .annotationsPane{
|
||||||
|
right: 0 !important;
|
||||||
|
top: 0 !important;
|
||||||
|
position: absolute !important;
|
||||||
|
}*/
|
||||||
afx-app-window[data-id="OpenPage"] div[data-id="odfcanvas"]
|
afx-app-window[data-id="OpenPage"] div[data-id="odfcanvas"]
|
||||||
{
|
{
|
||||||
cursor: text;
|
cursor: text;
|
||||||
margin:auto;
|
margin:auto;
|
||||||
box-shadow: 1px 1px 3px 3px #9f9F9F;
|
box-shadow: 1px 1px 3px 3px #9f9F9F;
|
||||||
|
/*added*/
|
||||||
|
transform-origin: top center;
|
||||||
|
-webkit-transform-origin: top center;
|
||||||
|
-moz-transform-origin: top center;
|
||||||
|
-o-transform-origin: top center;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
afx-app-window[data-id="OpenPage"] afx-hbox[data-id="toolbox"]
|
afx-app-window[data-id="OpenPage"] afx-hbox[data-id="toolbox"]
|
||||||
@ -44,6 +73,8 @@ afx-app-window[data-id="OpenPage"] afx-hbox[data-id="toolbox"] afx-button button
|
|||||||
border-radius:5px;
|
border-radius:5px;
|
||||||
color:#759DC0;
|
color:#759DC0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
afx-app-window[data-id="HyperLinkDialog"] afx-label.header span
|
afx-app-window[data-id="HyperLinkDialog"] afx-label.header span
|
||||||
{
|
{
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@ -59,7 +90,8 @@ afx-app-window[data-id="FormatDialog"] afx-label.header span
|
|||||||
}
|
}
|
||||||
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="aligmentbox"] afx-label span,
|
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="aligmentbox"] afx-label span,
|
||||||
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="spacingbox"] afx-label span,
|
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="spacingbox"] afx-label span,
|
||||||
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="stylebox"] afx-label span
|
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="stylebox"] afx-label span,
|
||||||
|
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="font-box"] > div > afx-label span
|
||||||
{
|
{
|
||||||
display: block;
|
display: block;
|
||||||
padding-top: 7px;
|
padding-top: 7px;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -9,5 +9,5 @@
|
|||||||
"version":"0.0.1-a",
|
"version":"0.0.1-a",
|
||||||
"category":"Other",
|
"category":"Other",
|
||||||
"iconclass":"fa fa-adn",
|
"iconclass":"fa fa-adn",
|
||||||
"mimes":["none"]
|
"mimes":["application/vnd.oasis.opendocument.text"]
|
||||||
}
|
}
|
@ -49,6 +49,7 @@ class FormatDialog extends this.OS.GUI.BaseDialog
|
|||||||
right: @find("spnright"),
|
right: @find("spnright"),
|
||||||
top: @find("spntop"),
|
top: @find("spntop"),
|
||||||
bottom: @find("spnbottom"),
|
bottom: @find("spnbottom"),
|
||||||
|
lineheight: @find("spnlheight")
|
||||||
padding:
|
padding:
|
||||||
left: @find("pspnleft"),
|
left: @find("pspnleft"),
|
||||||
right: @find("pspnright"),
|
right: @find("pspnright"),
|
||||||
@ -80,7 +81,8 @@ class FormatDialog extends this.OS.GUI.BaseDialog
|
|||||||
left:0
|
left:0
|
||||||
top:0,
|
top:0,
|
||||||
right:0,
|
right:0,
|
||||||
bottom:0
|
bottom:0,
|
||||||
|
lineheight: 0
|
||||||
padding:
|
padding:
|
||||||
left:0
|
left:0
|
||||||
top:0,
|
top:0,
|
||||||
@ -165,6 +167,7 @@ class FormatDialog extends this.OS.GUI.BaseDialog
|
|||||||
"fo:padding-left": @currentStyle.padding.left + "mm"
|
"fo:padding-left": @currentStyle.padding.left + "mm"
|
||||||
"fo:padding-bottom": @currentStyle.padding.bottom + "mm"
|
"fo:padding-bottom": @currentStyle.padding.bottom + "mm"
|
||||||
"fo:padding-right": @currentStyle.padding.right + "mm"
|
"fo:padding-right": @currentStyle.padding.right + "mm"
|
||||||
|
"fo:line-height": if @currentStyle.spacing.lineheight > 0 then @currentStyle.spacing.lineheight + "mm" else "normal"
|
||||||
"fo:text-align": @currentStyle.aligment.selected || "left"
|
"fo:text-align": @currentStyle.aligment.selected || "left"
|
||||||
"style:text-properties":
|
"style:text-properties":
|
||||||
"fo:font-weight": if @currentStyle.style.bold then "bold" else "normal"
|
"fo:font-weight": if @currentStyle.style.bold then "bold" else "normal"
|
||||||
@ -197,6 +200,7 @@ class FormatDialog extends this.OS.GUI.BaseDialog
|
|||||||
@currentStyle.padding.left = cssUnits.convertMeasure(style['fo:padding-left'], 'mm') || 0
|
@currentStyle.padding.left = cssUnits.convertMeasure(style['fo:padding-left'], 'mm') || 0
|
||||||
@currentStyle.padding.right = cssUnits.convertMeasure(style['fo:padding-right'], 'mm') || 0
|
@currentStyle.padding.right = cssUnits.convertMeasure(style['fo:padding-right'], 'mm') || 0
|
||||||
@currentStyle.padding.bottom = cssUnits.convertMeasure(style['fo:padding-bottom'], 'mm') || 0
|
@currentStyle.padding.bottom = cssUnits.convertMeasure(style['fo:padding-bottom'], 'mm') || 0
|
||||||
|
@currentStyle.spacing.lineheight = cssUnits.convertMeasure(style['fo:line-height'], 'mm') || 4.2 # 1em = 4,2175176mm
|
||||||
@currentStyle.aligment[style['fo:text-align']] = true if style['fo:text-align']
|
@currentStyle.aligment[style['fo:text-align']] = true if style['fo:text-align']
|
||||||
style = @parent.editorSession.getParagraphStyleAttributes(odfs.name)['style:text-properties']
|
style = @parent.editorSession.getParagraphStyleAttributes(odfs.name)['style:text-properties']
|
||||||
if style
|
if style
|
||||||
@ -220,6 +224,7 @@ class FormatDialog extends this.OS.GUI.BaseDialog
|
|||||||
@ui.spacing.right.set "value", @currentStyle.spacing.right
|
@ui.spacing.right.set "value", @currentStyle.spacing.right
|
||||||
@ui.spacing.top.set "value", @currentStyle.spacing.top
|
@ui.spacing.top.set "value", @currentStyle.spacing.top
|
||||||
@ui.spacing.bottom.set "value", @currentStyle.spacing.bottom
|
@ui.spacing.bottom.set "value", @currentStyle.spacing.bottom
|
||||||
|
@ui.spacing.lineheight.set "value", @currentStyle.spacing.lineheight
|
||||||
|
|
||||||
@ui.padding.left.set "value", @currentStyle.padding.left
|
@ui.padding.left.set "value", @currentStyle.padding.left
|
||||||
@ui.padding.right.set "value", @currentStyle.padding.right
|
@ui.padding.right.set "value", @currentStyle.padding.right
|
||||||
@ -237,11 +242,11 @@ class FormatDialog extends this.OS.GUI.BaseDialog
|
|||||||
item = i for v, i in items when v.text is @currentStyle.font.family.text
|
item = i for v, i in items when v.text is @currentStyle.font.family.text
|
||||||
@ui.font.family.set "selected", item if item >= 0
|
@ui.font.family.set "selected", item if item >= 0
|
||||||
|
|
||||||
$(@ui.style.color).css "background-color", @currentStyle.style.color.hex if @currentStyle.style.color
|
$(@ui.style.color).css "background-color", if @currentStyle.style.color then @currentStyle.style.color.hex else "#000000"
|
||||||
$(@ui.style.bgcolor).css "background-color", @currentStyle.style.bgcolor.hex if @currentStyle.style.bgcolor
|
$(@ui.style.bgcolor).css "background-color", if @currentStyle.style.bgcolor then @currentStyle.style.bgcolor.hex else "white"
|
||||||
# set the preview css
|
# set the preview css
|
||||||
el = $ @preview
|
el = $ @preview
|
||||||
el.css "text-align", @currentStyle.aligment.selected
|
el.css "text-align", if @currentStyle.aligment.selected then @currentStyle.aligment.selected else "left"
|
||||||
el.css "margin-left", @currentStyle.spacing.left + "mm"
|
el.css "margin-left", @currentStyle.spacing.left + "mm"
|
||||||
el.css "margin-right", @currentStyle.spacing.right + "mm"
|
el.css "margin-right", @currentStyle.spacing.right + "mm"
|
||||||
el.css "margin-top", @currentStyle.spacing.top + "mm"
|
el.css "margin-top", @currentStyle.spacing.top + "mm"
|
||||||
@ -256,13 +261,15 @@ class FormatDialog extends this.OS.GUI.BaseDialog
|
|||||||
.css "font-weight", "normal"
|
.css "font-weight", "normal"
|
||||||
.css "font-style", "normal"
|
.css "font-style", "normal"
|
||||||
.css "text-decoration", "none"
|
.css "text-decoration", "none"
|
||||||
|
.css "line-height", "normal"
|
||||||
el.css "font-weight", "bold" if @currentStyle.style.bold
|
el.css "font-weight", "bold" if @currentStyle.style.bold
|
||||||
el.css "font-style", "italic" if @currentStyle.style.italic
|
el.css "font-style", "italic" if @currentStyle.style.italic
|
||||||
el.css "text-decoration", "underline" if @currentStyle.style.underline
|
el.css "text-decoration", "underline" if @currentStyle.style.underline
|
||||||
el.css "color", @currentStyle.style.color.hex if @currentStyle.style.color
|
el.css "color", if @currentStyle.style.color then @currentStyle.style.color.hex else "#000000"
|
||||||
el.css "background-color", @currentStyle.style.bgcolor.hex if @currentStyle.style.bgcolor
|
el.css "background-color", if @currentStyle.style.bgcolor then @currentStyle.style.bgcolor.hex else "transparent"
|
||||||
el.css "font-size", @currentStyle.font.size + "pt"
|
el.css "font-size", @currentStyle.font.size + "pt"
|
||||||
el.css "font-family", @currentStyle.font.family.name if @currentStyle.font.family
|
el.css "font-family", @currentStyle.font.family.name if @currentStyle.font.family
|
||||||
|
el.css "line-height", @currentStyle.spacing.lineheight + "mm" if @currentStyle.spacing.lineheight > 0
|
||||||
|
|
||||||
FormatDialog.scheme = """
|
FormatDialog.scheme = """
|
||||||
<afx-app-window apptitle="__(Format Dialog)" width="500" height="500" data-id="FormatDialog">
|
<afx-app-window apptitle="__(Format Dialog)" width="500" height="500" data-id="FormatDialog">
|
||||||
@ -289,7 +296,7 @@ FormatDialog.scheme = """
|
|||||||
<div data-width="20" ></div>
|
<div data-width="20" ></div>
|
||||||
</afx-hbox>
|
</afx-hbox>
|
||||||
<div data-height="5"></div>
|
<div data-height="5"></div>
|
||||||
<afx-label text="__(Spacing)" class="header" data-height="20"></afx-label>
|
<afx-label text="__(Margin)" class="header" data-height="20"></afx-label>
|
||||||
<div data-height="5"></div>
|
<div data-height="5"></div>
|
||||||
<afx-hbox data-height="23" data-id="spacingbox">
|
<afx-hbox data-height="23" data-id="spacingbox">
|
||||||
<div ></div>
|
<div ></div>
|
||||||
@ -346,12 +353,15 @@ FormatDialog.scheme = """
|
|||||||
<div data-height="5"></div>
|
<div data-height="5"></div>
|
||||||
<afx-label text="__(Font)" class="header" data-height="20"></afx-label>
|
<afx-label text="__(Font)" class="header" data-height="20"></afx-label>
|
||||||
<div data-height="5"></div>
|
<div data-height="5"></div>
|
||||||
<afx-hbox data-height="30">
|
<afx-hbox data-height="30" data-id="font-box">
|
||||||
<div data-width="5"></div>
|
<div data-width="5"></div>
|
||||||
<afx-list-view data-id="lstfont" dropdown = "true"></afx-list-view>
|
<afx-list-view data-id="lstfont" dropdown = "true"></afx-list-view>
|
||||||
<div data-width="5" ></div>
|
<div data-width="5" ></div>
|
||||||
<afx-label data-width="35" text="__(Size:)"></afx-label>
|
<afx-label data-width="35" text="__(Size:)"></afx-label>
|
||||||
<afx-nspinner data-width="50" data-id="spnfsize"></afx-nspinner>
|
<afx-nspinner data-width="50" data-id="spnfsize"></afx-nspinner>
|
||||||
|
<div data-width="5" ></div>
|
||||||
|
<afx-label data-width="80" text="__(Line Height:)"></afx-label>
|
||||||
|
<afx-nspinner data-width="50" data-id="spnlheight" value="4.2" step="0.2"></afx-nspinner>
|
||||||
<div data-width="5"></div>
|
<div data-width="5"></div>
|
||||||
</afx-hbox>
|
</afx-hbox>
|
||||||
<div data-height="5"></div>
|
<div data-height="5"></div>
|
||||||
|
@ -7,15 +7,96 @@ class OpenPage extends this.OS.GUI.BaseApplication
|
|||||||
#if not OpenPage.EditorSession
|
#if not OpenPage.EditorSession
|
||||||
# require ["webodf/editor/EditorSession"], (ES) ->
|
# require ["webodf/editor/EditorSession"], (ES) ->
|
||||||
# OpenPage.EditorSession = ES
|
# OpenPage.EditorSession = ES
|
||||||
@userid = @systemsetting.user.username
|
me =@
|
||||||
@eventSubscriptions = new core.EventSubscriptions()
|
@eventSubscriptions = new core.EventSubscriptions()
|
||||||
@initToolbox()
|
@initToolbox()
|
||||||
@initCanvas()
|
@userid = "#{@systemsetting.user.username}@#{@pid}"
|
||||||
@canvas.load "#{@_api.handler.get}/home://welcome.odt"
|
#file = "home://welcome.odt"
|
||||||
|
#file = "#{@_api.handler.get}/home://welcome.odt"
|
||||||
|
#@canvas.load file
|
||||||
|
#odfContainer = new odf.OdfContainer file, (c) ->
|
||||||
|
# me.canvas.setOdfContainer c, false
|
||||||
@currentStyle = ""
|
@currentStyle = ""
|
||||||
|
if @args and @args.length > 0 then @open @args[0] else @newdoc()
|
||||||
@resource =
|
@resource =
|
||||||
fonts: []
|
fonts: []
|
||||||
formats: []
|
formats: []
|
||||||
|
@bindKey "ALT-N", () -> me.actionFile "#{me.name}-New"
|
||||||
|
@bindKey "ALT-O", () -> me.actionFile "#{me.name}-Open"
|
||||||
|
@bindKey "CTRL-S", () -> me.actionFile "#{me.name}-Save"
|
||||||
|
@bindKey "ALT-W", () -> me.actionFile "#{me.name}-Saveas"
|
||||||
|
|
||||||
|
|
||||||
|
menu: () ->
|
||||||
|
me = @
|
||||||
|
menu = [{
|
||||||
|
text: "__(File)",
|
||||||
|
child: [
|
||||||
|
{ text: "__(New)", dataid: "#{@name}-New", shortcut: "A-N" },
|
||||||
|
{ text: "__(Open)", dataid: "#{@name}-Open", shortcut: "A-O" },
|
||||||
|
{ text: "__(Save)", dataid: "#{@name}-Save", shortcut: "C-S" },
|
||||||
|
{ text: "__(Save as)", dataid: "#{@name}-Saveas", shortcut: "A-W" }
|
||||||
|
],
|
||||||
|
onmenuselect: (e) -> me.actionFile e.item.data.dataid
|
||||||
|
}]
|
||||||
|
menu
|
||||||
|
|
||||||
|
actionFile: (e) ->
|
||||||
|
me = @
|
||||||
|
saveas = () ->
|
||||||
|
me.openDialog "FileDiaLog", (d, n, p) ->
|
||||||
|
me.currfile.setPath "#{d}#{n}"
|
||||||
|
me.save()
|
||||||
|
, __("Save as"), { file: me.currfile }
|
||||||
|
switch e
|
||||||
|
when "#{@name}-Open"
|
||||||
|
@openDialog "FileDiaLog", ( d, f , p) ->
|
||||||
|
me.open p
|
||||||
|
, __("Open file"), { mimes: me.meta().mimes }
|
||||||
|
when "#{@name}-Save"
|
||||||
|
#@currfile.cache = @editor.value()
|
||||||
|
return @save() if @currfile.basename
|
||||||
|
saveas()
|
||||||
|
when "#{@name}-Saveas"
|
||||||
|
saveas()
|
||||||
|
when "#{@name}-New"
|
||||||
|
@newdoc()
|
||||||
|
|
||||||
|
|
||||||
|
newdoc: () ->
|
||||||
|
blank = "#{@meta().path}/blank.odt"
|
||||||
|
@open blank, true
|
||||||
|
open: (p,b) ->
|
||||||
|
me = @
|
||||||
|
|
||||||
|
@pathAsDataURL(p)
|
||||||
|
.then (r) ->
|
||||||
|
me.closeDocument() if me.editorSession
|
||||||
|
me.initCanvas()
|
||||||
|
OdfContainer = new odf.OdfContainer r.reader.result, (c) ->
|
||||||
|
me.canvas.setOdfContainer c, false
|
||||||
|
return me.currfile = "Untitled".asFileHandler() if b
|
||||||
|
me.currfile.setPath p
|
||||||
|
me.scheme.set "apptitle", me.currfile.basename
|
||||||
|
me.notify __("File {0} opened", p)
|
||||||
|
.catch (e) ->
|
||||||
|
me.error __("Problem read file {0}", e)
|
||||||
|
|
||||||
|
save: () ->
|
||||||
|
me = @
|
||||||
|
return unless @editorSession
|
||||||
|
container = @canvas.odfContainer()
|
||||||
|
return @error __("No document container found") unless container
|
||||||
|
container.createByteArray (ba) ->
|
||||||
|
# create blob
|
||||||
|
me.currfile.cache = new Blob [ba], { type: "application/vnd.oasis.opendocument.text" }
|
||||||
|
me.currfile.write "application/vnd.oasis.opendocument.text", (r) ->
|
||||||
|
return me.error __("Cannot save file: {0}", r.error) if r.error
|
||||||
|
me.notify __("File {0} saved", me.currfile.basename)
|
||||||
|
me.scheme.set "apptitle", me.currfile.basename
|
||||||
|
me.currfile.dirty = false
|
||||||
|
, (err) ->
|
||||||
|
@error __("Cannot create byte array from container: {0}", err|| "")
|
||||||
|
|
||||||
initToolbox: () ->
|
initToolbox: () ->
|
||||||
me = @
|
me = @
|
||||||
@ -69,8 +150,14 @@ class OpenPage extends this.OS.GUI.BaseApplication
|
|||||||
el.classList.add "notranslate"
|
el.classList.add "notranslate"
|
||||||
@canvas = new odf.OdfCanvas(el)
|
@canvas = new odf.OdfCanvas(el)
|
||||||
@documentChanged = (e) ->
|
@documentChanged = (e) ->
|
||||||
|
return if me.currfile.dirty
|
||||||
|
me.currfile.dirty = true
|
||||||
|
me.scheme.set "apptitle", me.currfile.basename + "*"
|
||||||
#console.log e
|
#console.log e
|
||||||
@metaChanged = (e) ->
|
@metaChanged = (e) ->
|
||||||
|
return if me.currfile.dirty
|
||||||
|
me.currfile.dirty = true
|
||||||
|
me.scheme.set "apptitle", me.currfile.basename + "*"
|
||||||
#console.log e
|
#console.log e
|
||||||
@textStylingChanged = (e) ->
|
@textStylingChanged = (e) ->
|
||||||
me.updateToolbar e
|
me.updateToolbar e
|
||||||
@ -97,8 +184,7 @@ class OpenPage extends this.OS.GUI.BaseApplication
|
|||||||
me.basictool.zoom.set "value", value
|
me.basictool.zoom.set "value", value
|
||||||
zlb = me.find "lbzoom"
|
zlb = me.find "lbzoom"
|
||||||
zlb.set "text", value+"%"
|
zlb.set "text", value+"%"
|
||||||
|
#me.canvas.enableAnnotations true, true
|
||||||
#@canvas.enableAnnotations(true, true)
|
|
||||||
@canvas.addListener "statereadychange", ()->
|
@canvas.addListener "statereadychange", ()->
|
||||||
me.session = new ops.Session(me.canvas)
|
me.session = new ops.Session(me.canvas)
|
||||||
viewOptions =
|
viewOptions =
|
||||||
@ -118,6 +204,10 @@ class OpenPage extends this.OS.GUI.BaseApplication
|
|||||||
zoomingEnabled: true,
|
zoomingEnabled: true,
|
||||||
reviewModeEnabled: false
|
reviewModeEnabled: false
|
||||||
})
|
})
|
||||||
|
me.initFontList me.editorSession.getDeclaredFonts()
|
||||||
|
me.initStyles me.editorSession.getAvailableParagraphStyles()
|
||||||
|
#fix annotation problem on canvas
|
||||||
|
#console.log $("office:body").css "background-color", "red"
|
||||||
# basic format
|
# basic format
|
||||||
me.directFormattingCtl = me.editorSession.sessionController.getDirectFormattingController()
|
me.directFormattingCtl = me.editorSession.sessionController.getDirectFormattingController()
|
||||||
me.directFormattingCtl.subscribe gui.DirectFormattingController.textStylingChanged, me.textStylingChanged
|
me.directFormattingCtl.subscribe gui.DirectFormattingController.textStylingChanged, me.textStylingChanged
|
||||||
@ -130,6 +220,8 @@ class OpenPage extends this.OS.GUI.BaseApplication
|
|||||||
me.eventSubscriptions.addFrameSubscription me.editorSession, OpenPage.EditorSession.signalParagraphChanged, ()-> me.updateHyperlinkButtons()
|
me.eventSubscriptions.addFrameSubscription me.editorSession, OpenPage.EditorSession.signalParagraphChanged, ()-> me.updateHyperlinkButtons()
|
||||||
me.eventSubscriptions.addFrameSubscription me.editorSession, OpenPage.EditorSession.signalParagraphStyleModified, ()-> me.updateHyperlinkButtons()
|
me.eventSubscriptions.addFrameSubscription me.editorSession, OpenPage.EditorSession.signalParagraphStyleModified, ()-> me.updateHyperlinkButtons()
|
||||||
|
|
||||||
|
#annotation controller
|
||||||
|
me.annotationController = me.editorSession.sessionController.getAnnotationController()
|
||||||
|
|
||||||
#image controller
|
#image controller
|
||||||
me.imageController = me.editorSession.sessionController.getImageController()
|
me.imageController = me.editorSession.sessionController.getImageController()
|
||||||
@ -158,8 +250,6 @@ class OpenPage extends this.OS.GUI.BaseApplication
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
me.session.enqueue([op])
|
me.session.enqueue([op])
|
||||||
me.initFontList me.editorSession.getDeclaredFonts()
|
|
||||||
me.initStyles me.editorSession.getAvailableParagraphStyles()
|
|
||||||
me.editorSession.sessionController.insertLocalCursor()
|
me.editorSession.sessionController.insertLocalCursor()
|
||||||
me.editorSession.sessionController.startEditing()
|
me.editorSession.sessionController.startEditing()
|
||||||
#console.log me.editorSession.getDeclaredFonts()
|
#console.log me.editorSession.getDeclaredFonts()
|
||||||
@ -230,6 +320,9 @@ class OpenPage extends this.OS.GUI.BaseApplication
|
|||||||
ac: (e) ->
|
ac: (e) ->
|
||||||
@directFormattingCtl.alignParagraphCenter()
|
@directFormattingCtl.alignParagraphCenter()
|
||||||
|
|
||||||
|
note: (e) ->
|
||||||
|
@annotationController.addAnnotation()
|
||||||
|
|
||||||
aj: (e) ->
|
aj: (e) ->
|
||||||
@directFormattingCtl.alignParagraphJustified()
|
@directFormattingCtl.alignParagraphJustified()
|
||||||
|
|
||||||
@ -289,30 +382,37 @@ class OpenPage extends this.OS.GUI.BaseApplication
|
|||||||
redo: (e) ->
|
redo: (e) ->
|
||||||
@editorSession.redo()
|
@editorSession.redo()
|
||||||
|
|
||||||
image: (e) ->
|
pathAsDataURL: (p) ->
|
||||||
me = @
|
return new Promise (resolve, error) ->
|
||||||
@openDialog "FileDiaLog", (d, n, p) ->
|
|
||||||
fp = p.asFileHandler()
|
fp = p.asFileHandler()
|
||||||
fp.asFileHandler().read (data) ->
|
fp.read (data) ->
|
||||||
blob = new Blob [data], { type: fp.info.mime }
|
blob = new Blob [data], { type: fp.info.mime }
|
||||||
reader = new FileReader()
|
reader = new FileReader()
|
||||||
reader.onloadend = () ->
|
reader.onloadend = () ->
|
||||||
return me.error __("Couldnt load image {0}", p) if reader.readyState isnt 2
|
return error(p) if reader.readyState isnt 2
|
||||||
# insert the image to document
|
resolve {reader: reader, fp: fp }
|
||||||
|
reader.readAsDataURL blob
|
||||||
|
, "binary"
|
||||||
|
|
||||||
|
|
||||||
|
image: (e) ->
|
||||||
|
me = @
|
||||||
|
@openDialog "FileDiaLog", (d, n, p) ->
|
||||||
|
me.pathAsDataURL(p)
|
||||||
|
.then (r) ->
|
||||||
hiddenImage = new Image()
|
hiddenImage = new Image()
|
||||||
hiddenImage.style.position = "absolute"
|
hiddenImage.style.position = "absolute"
|
||||||
hiddenImage.style.left = "-99999px"
|
hiddenImage.style.left = "-99999px"
|
||||||
document.body.appendChild hiddenImage
|
document.body.appendChild hiddenImage
|
||||||
hiddenImage.onload = () ->
|
hiddenImage.onload = () ->
|
||||||
content = reader.result.substring(reader.result.indexOf(",") + 1)
|
content = r.reader.result.substring(r.reader.result.indexOf(",") + 1)
|
||||||
#insert image
|
#insert image
|
||||||
me.textController.removeCurrentSelection()
|
me.textController.removeCurrentSelection()
|
||||||
me.imageController.insertImage fp.info.mime, content, hiddenImage.width, hiddenImage.height
|
me.imageController.insertImage r.fp.info.mime, content, hiddenImage.width, hiddenImage.height
|
||||||
document.body.removeChild hiddenImage
|
document.body.removeChild hiddenImage
|
||||||
hiddenImage.src = reader.result
|
hiddenImage.src = r.reader.result
|
||||||
|
.catch () ->
|
||||||
reader.readAsDataURL blob
|
me.error __("Couldnt load image {0}", p)
|
||||||
, "binary"
|
|
||||||
, __("Select image file"), { mimes: ["image/.*"] }
|
, __("Select image file"), { mimes: ["image/.*"] }
|
||||||
|
|
||||||
styles: (e) ->
|
styles: (e) ->
|
||||||
@ -321,11 +421,12 @@ class OpenPage extends this.OS.GUI.BaseApplication
|
|||||||
|
|
||||||
zoom: (e) ->
|
zoom: (e) ->
|
||||||
#console.log "zooming", e
|
#console.log "zooming", e
|
||||||
|
return unless @zoomHelper
|
||||||
@zoomHelper.setZoomLevel e/100.0
|
@zoomHelper.setZoomLevel e/100.0
|
||||||
|
|
||||||
format: (e) ->
|
format: (e) ->
|
||||||
@openDialog new FormatDialog(), (d) ->
|
@openDialog new FormatDialog(), (d) ->
|
||||||
console.log d
|
return
|
||||||
, __("Add/Modify paragraph format"), @resource
|
, __("Add/Modify paragraph format"), @resource
|
||||||
|
|
||||||
closeDocument: () ->
|
closeDocument: () ->
|
||||||
@ -362,6 +463,7 @@ class OpenPage extends this.OS.GUI.BaseApplication
|
|||||||
return me.error __("Cannot destroy canvas {0}", e) if e
|
return me.error __("Cannot destroy canvas {0}", e) if e
|
||||||
me.notify "Document closed"
|
me.notify "Document closed"
|
||||||
me.session = undefined
|
me.session = undefined
|
||||||
|
me.annotationController = undefined
|
||||||
me.directFormattingCtl = undefined
|
me.directFormattingCtl = undefined
|
||||||
me.textController = undefined
|
me.textController = undefined
|
||||||
me.imageController = undefined
|
me.imageController = undefined
|
||||||
@ -372,6 +474,8 @@ class OpenPage extends this.OS.GUI.BaseApplication
|
|||||||
me.paragrahStyleChanged = undefined
|
me.paragrahStyleChanged = undefined
|
||||||
me.updateSlider = undefined
|
me.updateSlider = undefined
|
||||||
me.styleAdded = undefined
|
me.styleAdded = undefined
|
||||||
|
me.basictool.fonts.set "selected", -1
|
||||||
|
me.basictool.styles.set "selected", -1
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@ afx-app-window[data-id="FormatDialog"] afx-label.header span
|
|||||||
}
|
}
|
||||||
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="aligmentbox"] afx-label span,
|
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="aligmentbox"] afx-label span,
|
||||||
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="spacingbox"] afx-label span,
|
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="spacingbox"] afx-label span,
|
||||||
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="stylebox"] afx-label span
|
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="stylebox"] afx-label span,
|
||||||
|
afx-app-window[data-id="FormatDialog"] afx-hbox[data-id="font-box"] > div > afx-label span
|
||||||
{
|
{
|
||||||
display: block;
|
display: block;
|
||||||
padding-top: 7px;
|
padding-top: 7px;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
@namespace office url(urn:oasis:names:tc:opendocument:xmlns:office:1.0);
|
||||||
afx-app-window[data-id="OpenPage"] div[data-id="container"]
|
afx-app-window[data-id="OpenPage"] div[data-id="container"]
|
||||||
{
|
{
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
@ -7,13 +8,41 @@ afx-app-window[data-id="OpenPage"] div[data-id="container"]
|
|||||||
padding-bottom: 10px;
|
padding-bottom: 10px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background-color: #f2f1f0;
|
background-color: #f2f1f0;
|
||||||
|
/*position: relative;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@media screen, print, handheld, projection
|
||||||
|
{
|
||||||
|
office|body{
|
||||||
|
display: inline !important;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Fix annotation problem not showing
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
afx-app-window[data-id="OpenPage"] document, afx-app-window[data-id="OpenPage"] office:body{
|
||||||
|
display: inline !important;
|
||||||
|
}
|
||||||
|
afx-app-window[data-id="OpenPage"] .annotationsPane{
|
||||||
|
right: 0 !important;
|
||||||
|
top: 0 !important;
|
||||||
|
position: absolute !important;
|
||||||
|
}*/
|
||||||
afx-app-window[data-id="OpenPage"] div[data-id="odfcanvas"]
|
afx-app-window[data-id="OpenPage"] div[data-id="odfcanvas"]
|
||||||
{
|
{
|
||||||
cursor: text;
|
cursor: text;
|
||||||
margin:auto;
|
margin:auto;
|
||||||
box-shadow: 1px 1px 3px 3px #9f9F9F;
|
box-shadow: 1px 1px 3px 3px #9f9F9F;
|
||||||
|
/*added*/
|
||||||
|
transform-origin: top center;
|
||||||
|
-webkit-transform-origin: top center;
|
||||||
|
-moz-transform-origin: top center;
|
||||||
|
-o-transform-origin: top center;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
afx-app-window[data-id="OpenPage"] afx-hbox[data-id="toolbox"]
|
afx-app-window[data-id="OpenPage"] afx-hbox[data-id="toolbox"]
|
||||||
@ -43,3 +72,4 @@ afx-app-window[data-id="OpenPage"] afx-hbox[data-id="toolbox"] afx-button button
|
|||||||
border-radius:5px;
|
border-radius:5px;
|
||||||
color:#759DC0;
|
color:#759DC0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,5 +9,5 @@
|
|||||||
"version":"0.0.1-a",
|
"version":"0.0.1-a",
|
||||||
"category":"Other",
|
"category":"Other",
|
||||||
"iconclass":"fa fa-adn",
|
"iconclass":"fa fa-adn",
|
||||||
"mimes":["none"]
|
"mimes":["application/vnd.oasis.opendocument.text"]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user