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
8b160ac6
Commit
8b160ac6
authored
Jun 28, 2011
by
François Billioud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename editor files
parent
76802998
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
230 additions
and
0 deletions
+230
-0
UNGProject/js/image-editor.js
UNGProject/js/image-editor.js
+59
-0
UNGProject/js/table-editor.js
UNGProject/js/table-editor.js
+106
-0
UNGProject/js/text-editor.js
UNGProject/js/text-editor.js
+65
-0
No files found.
UNGProject/js/image-editor.js
0 → 100644
View file @
8b160ac6
/**
* This file provides classes needed by the illustration editor
*/
/**
* Editors
* editors must implement the following methods :
* load : load the editor in the current page
* saveEdition : save the edition made by this editor to the current document
* loadContentFromDocument : display the content of the specified document in the editor
*/
SVGEditor
=
function
()
{
this
.
name
=
"
svg-editor
"
;
this
.
load
=
function
()
{
$
(
"
#svgframe
"
).
attr
(
"
src
"
,
"
svg-edit/svg-editor.html
"
);}
this
.
saveEdition
=
function
()
{
var
s
=
"
svgframe
"
;
getCurrentDocument
().
saveEdition
(
window
.
frames
[
s
].
svgCanvas
.
getSvgString
());
}
this
.
loadContentFromDocument
=
function
(
doc
)
{
tryUntilSucceed
(
function
()
{
window
.
frames
[
"
svgframe
"
].
svgEditor
.
loadFromString
(
doc
.
getContent
());});
}
this
.
load
();
}
/**
* SVG documents
* editable documents must implements the following methods
* getType : returns the type of a document
* saveEdition : set the argument as the new content of the document. Change last modification time and display the changes
* setAsCurrentDocument : set the document as currentDocument in the local storage and display its properties in the current page
*/
var
JSONIllustrationDocument
=
function
()
{
JSONDocument
.
call
(
this
);
//inherits properties from JSONDocument
this
.
type
=
"
illustration
"
;
}
JSONIllustrationDocument
.
prototype
=
new
JSONDocument
();
//inherits methods from JSONDocument
JSONIllustrationDocument
.
prototype
.
saveEdition
=
function
(
content
)
{
this
.
setContent
(
content
);
this
.
setLastModification
(
currentTime
());
this
.
setAsCurrentDocument
();
}
JSONIllustrationDocument
.
prototype
.
setAsCurrentDocument
=
function
()
{
getCurrentPage
().
displayDocumentTitle
(
this
);
getCurrentPage
().
displayDocumentState
(
this
);
getCurrentPage
().
displayDocumentContent
(
this
);
getCurrentPage
().
displayAuthorName
(
this
);
getCurrentPage
().
displayLastModification
(
this
);
setCurrentDocument
(
this
);
}
getCurrentDocument
=
function
()
{
var
doc
=
new
JSONIllustrationDocument
();
doc
.
load
(
JSON
.
parse
(
localStorage
.
getItem
(
"
currentDocument
"
)));
return
doc
;
}
UNGProject/js/table-editor.js
0 → 100644
View file @
8b160ac6
/**
* Editors
*/
SheetEditor
=
function
()
{
this
.
name
=
"
JQuery Sheet Editor
"
;
this
.
load
=
function
()
{
$
(
"
#jQuerySheet0
"
).
sheet
({
buildSheet
:
'
10x15
'
,
title
:
'
Spreadsheet Playground
'
,
inlineMenu
:
inlineMenu
(
$
.
sheet
.
instance
)
});
}
this
.
saveEdition
=
function
()
{}
this
.
loadContentFromDocument
=
function
(
doc
)
{}
this
.
load
();
}
/***
* Spreadsheet documents
*/
var
JSONSheetDocument
=
function
()
{
JSONDocument
.
call
(
this
);
//inherits from JSONDocument
this
.
type
=
"
sheet
"
;
this
.
width
=
10
;
this
.
height
=
15
;
}
JSONSheetDocument
.
prototype
=
new
JSONDocument
();
//inheritance
//accessors
JSONSheetDocument
.
prototype
.
load
({
getWidth
:
function
()
{
return
this
.
width
;},
setWidth
:
function
(
newWidth
)
{
this
.
width
=
newWidth
;},
getHeight
:
function
()
{
return
this
.
height
;},
setHeight
:
function
(
newHeight
)
{
this
.
height
=
newHeight
;},
//save process
saveEdition
:
function
(
content
)
{
this
.
setContent
(
content
);
this
.
setLastModification
(
currentTime
());
this
.
setAsCurrentDocument
();
},
//display document information
setAsCurrentDocument
:
function
()
{
getCurrentPage
().
displayDocumentTitle
(
this
);
//getCurrentPage().displayDocumentContent(this);
getCurrentPage
().
displayDocumentState
(
this
);
getCurrentPage
().
displayAuthorName
(
this
);
getCurrentPage
().
displayLastModification
(
this
);
setCurrentDocument
(
this
);
}
});
getCurrentDocument
=
function
()
{
var
doc
=
new
JSONSheetDocument
();
doc
.
load
(
JSON
.
parse
(
localStorage
.
getItem
(
"
currentDocument
"
)));
return
doc
;
}
function
inlineMenu
(
instance
)
{
var
I
=
(
instance
?
instance
.
length
:
0
);
var
html
=
$
(
'
#inlineMenu
'
).
html
().
replace
(
/sheetInstance/g
,
"
$.sheet.instance[
"
+
I
+
"
]
"
);
var
menu
=
$
(
html
);
menu
.
find
(
'
.colorPickerCell
'
)
.
colorPicker
()
.
change
(
function
()
{
$
.
sheet
.
instance
[
I
].
cellUndoable
.
add
(
$
.
sheet
.
instance
[
I
].
obj
.
cellHighlighted
());
$
.
sheet
.
instance
[
I
].
obj
.
cellHighlighted
().
css
(
'
background-color
'
,
$
(
this
).
val
());
$
.
sheet
.
instance
[
I
].
cellUndoable
.
add
(
$
.
sheet
.
instance
[
I
].
obj
.
cellHighlighted
());
});
menu
.
find
(
'
.colorPickerFont
'
)
.
colorPicker
()
.
change
(
function
()
{
$
.
sheet
.
instance
[
I
].
cellUndoable
.
add
(
$
.
sheet
.
instance
[
I
].
obj
.
cellHighlighted
());
$
.
sheet
.
instance
[
I
].
obj
.
cellHighlighted
().
css
(
'
color
'
,
$
(
this
).
val
());
$
.
sheet
.
instance
[
I
].
cellUndoable
.
add
(
$
.
sheet
.
instance
[
I
].
obj
.
cellHighlighted
());
});
menu
.
find
(
'
.colorPickers
'
)
.
children
().
eq
(
1
).
css
(
'
background-image
'
,
"
url('jquery_sheet_editor/jquery_sheet_image/palette.png')
"
);
menu
.
find
(
'
.colorPickers
'
)
.
children
().
eq
(
3
).
css
(
'
background-image
'
,
"
url('jquery_sheet_editor/jquery_sheet_image/palette_bg.png')
"
);
return
menu
;
}
function
goToObj
(
s
)
{
$
(
'
html, body
'
).
animate
({
scrollTop
:
$
(
s
).
offset
().
top
},
'
slow
'
);
return
false
;
}
UNGProject/js/text-editor.js
0 → 100644
View file @
8b160ac6
/**
* This file provides classes needed by the text editor
*/
/**
* Editors
* editors must implement the following methods :
* load : load the editor in the current page
* saveEdition : save the edition made by this editor to the current document
* loadContentFromDocument : display the content of the specified document in the editor
*/
var
Xinha
=
function
()
{
this
.
name
=
"
Xinha
"
;
this
.
load
=
function
()
{
_editor_url
=
"
xinha/
"
;
getCurrentPage
().
include
(
"
xinha/XinhaCore.js
"
,
"
script
"
);
getCurrentPage
().
include
(
"
xinha/config.js
"
,
"
script
"
);
xinha_init
();
}
this
.
saveEdition
=
function
()
{
getCurrentDocument
().
saveEdition
(
xinha_editors
.
input_area
.
getEditorContent
());
}
this
.
loadContentFromDocument
=
function
(
doc
)
{
var
setText
=
function
()
{
xinha_editors
.
input_area
.
setEditorContent
(
doc
.
getContent
());}
tryUntilSucceed
(
setText
);
}
this
.
load
();
}
/**
* Text documents
* editable documents must implements the following methods
* getType : returns the type of a document
* saveEdition : set the argument as the new content of the document. Change last modification time and display the changes
* setAsCurrentDocument : set the document as currentDocument in the local storage and display its properties in the current page
*/
var
JSONTextDocument
=
function
()
{
JSONDocument
.
call
(
this
);
//inherits properties from JSONDocument
this
.
type
=
"
text
"
;
}
JSONTextDocument
.
prototype
=
new
JSONDocument
();
//inherits methods from JSONDocument
JSONTextDocument
.
prototype
.
saveEdition
=
function
(
content
)
{
this
.
setContent
(
content
);
this
.
setLastModification
(
currentTime
());
this
.
setAsCurrentDocument
();
}
JSONTextDocument
.
prototype
.
setAsCurrentDocument
=
function
()
{
getCurrentPage
().
displayDocumentTitle
(
this
);
getCurrentPage
().
displayDocumentState
(
this
);
getCurrentPage
().
displayDocumentContent
(
this
);
getCurrentPage
().
displayAuthorName
(
this
);
getCurrentPage
().
displayLastModification
(
this
);
setCurrentDocument
(
this
);
}
getCurrentDocument
=
function
()
{
var
doc
=
new
JSONTextDocument
();
doc
.
load
(
JSON
.
parse
(
localStorage
.
getItem
(
"
currentDocument
"
)));
return
doc
;
}
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