Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
ff482cae
Commit
ff482cae
authored
14 years ago
by
Michal Rezler
Browse files
Options
Downloads
Patches
Plain Diff
fixed import for drag.js and started a rewrite of edit.js
parent
5ed44c0e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/exe/js.php
+1
-0
1 addition, 0 deletions
lib/exe/js.php
lib/scripts/edit.js
+66
-49
66 additions, 49 deletions
lib/scripts/edit.js
with
67 additions
and
49 deletions
lib/exe/js.php
+
1
−
0
View file @
ff482cae
...
...
@@ -55,6 +55,7 @@ function js_out(){
DOKU_INC
.
'lib/scripts/tw-sack.js'
,
DOKU_INC
.
'lib/scripts/ajax.js'
,
DOKU_INC
.
'lib/scripts/index.js'
,
DOKU_INC
.
'lib/scripts/drag.js'
,
DOKU_INC
.
'lib/scripts/textselection.js'
,
DOKU_INC
.
'lib/scripts/toolbar.js'
,
DOKU_INC
.
'lib/scripts/edit.js'
,
...
...
This diff is collapsed.
Click to expand it.
lib/scripts/edit.js
+
66
−
49
View file @
ff482cae
...
...
@@ -11,37 +11,41 @@
* Style the buttons through the toolbutton class
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Michal Rezler <m.rezler@centrum.cz>
*/
function
createToolButton
(
icon
,
label
,
key
,
id
,
classname
){
var
btn
=
document
.
createElement
(
'
button
'
);
var
ico
=
document
.
createElement
(
'
img
'
);
var
$
=
jQuery
;
var
btn
=
$
(
'
<button>
'
);
var
ico
=
$
(
'
<img />
'
);
// preapare the basic button stuff
btn
.
className
=
'
toolbutton
'
;
btn
.
attr
(
'
class
'
,
'
toolbutton
'
)
;
if
(
classname
){
btn
.
className
+=
'
'
+
classname
;
btn
.
attr
(
'
class
'
,
'
toolbutton
'
+
classname
)
;
}
btn
.
title
=
label
;
btn
.
attr
(
'
title
'
,
label
);
if
(
key
){
btn
.
title
+
=
'
[
'
+
key
.
toUpperCase
()
+
'
]
'
;
btn
.
accessKey
=
key
;
btn
.
attr
(
'
title
'
,
label
+
'
[
'
+
key
.
toUpperCase
()
+
'
]
'
)
.
attr
(
'
accessKey
'
,
key
);
}
// set IDs if given
if
(
id
){
btn
.
id
=
id
;
ico
.
id
=
id
+
'
_ico
'
;
btn
.
attr
(
'
id
'
,
id
)
;
ico
.
attr
(
'
id
'
,
id
+
'
_ico
'
)
;
}
// create the icon and add it to the button
if
(
icon
.
substr
(
0
,
1
)
==
'
/
'
){
ico
.
src
=
icon
;
ico
.
attr
(
'
src
'
,
icon
)
;
}
else
{
ico
.
src
=
DOKU_BASE
+
'
lib/images/toolbar/
'
+
icon
;
ico
.
attr
(
'
src
'
,
DOKU_BASE
+
'
lib/images/toolbar/
'
+
icon
)
;
}
btn
.
appendChild
(
ico
);
return
btn
;
btn
.
append
(
ico
);
// we have to return a javascript object (for compatibility reasons)
return
btn
[
0
];
}
/**
...
...
@@ -60,45 +64,56 @@ function createToolButton(icon,label,key,id,classname){
*/
function
createPicker
(
id
,
props
,
edid
){
var
icobase
=
props
[
'
icobase
'
];
var
list
=
props
[
'
list
'
];
var
list
=
props
[
'
list
'
];
var
$
=
jQuery
;
// create the wrapping div
var
picker
=
document
.
createElement
(
'
div
'
);
picker
.
className
=
'
picker
'
;
var
picker
=
$
(
'
<div></div>
'
);
var
className
=
'
picker
'
;
if
(
props
[
'
class
'
]){
picker
.
className
+=
'
'
+
props
[
'
class
'
];
className
+=
'
'
+
props
[
'
class
'
];
}
picker
.
id
=
id
;
picker
.
style
.
position
=
'
absolute
'
;
picker
.
style
.
marginLeft
=
'
-10000px
'
;
// no display:none, to keep access keys working
picker
.
style
.
marginTop
=
'
-10000px
'
;
picker
.
attr
(
'
class
'
,
className
)
.
attr
(
'
id
'
,
id
)
.
css
(
'
position
'
,
'
absolute
'
)
.
css
(
'
marginLeft
'
,
'
-10000px
'
)
// no display:none, to keep access keys working
.
css
(
'
marginTop
'
,
'
-10000px
'
);
for
(
var
key
in
list
){
if
(
!
list
.
hasOwnProperty
(
key
))
continue
;
if
(
isNaN
(
key
)){
// associative array -> treat as image/value pairs
var
btn
=
document
.
createElement
(
'
button
'
);
btn
.
className
=
'
pickerbutton
'
;
var
ico
=
document
.
createElement
(
'
img
'
);
if
(
list
[
key
].
substr
(
0
,
1
)
==
'
/
'
){
ico
.
src
=
list
[
key
];
}
else
{
ico
.
src
=
DOKU_BASE
+
'
lib/images/
'
+
icobase
+
'
/
'
+
list
[
key
];
var
btn
=
$
(
'
<button>
'
);
btn
.
attr
(
'
class
'
,
'
pickerbutton
'
)
.
attr
(
'
title
'
,
key
);
var
ico
=
$
(
'
<img>
'
);
if
(
list
[
key
].
substr
(
0
,
1
)
==
'
/
'
)
{
var
src
=
list
[
key
];
}
else
{
var
src
=
DOKU_BASE
+
'
lib/images/
'
+
icobase
+
'
/
'
+
list
[
key
];
}
btn
.
title
=
key
;
btn
.
appendChild
(
ico
);
addEvent
(
btn
,
'
click
'
,
bind
(
pickerInsert
,
key
,
edid
));
picker
.
appendChild
(
btn
);
}
else
if
(
typeof
(
list
[
key
])
==
'
string
'
){
ico
.
attr
(
'
src
'
,
src
);
btn
.
append
(
ico
);
btn
.
bind
(
'
click
'
,
bind
(
pickerInsert
,
key
,
edid
));
picker
.
append
(
btn
);
}
else
if
(
typeof
(
list
[
key
])
==
'
string
'
){
// a list of text -> treat as text picker
var
btn
=
document
.
createElement
(
'
button
'
);
btn
.
className
=
'
pickerbutton
'
;
var
txt
=
document
.
createTextNode
(
list
[
key
]);
btn
.
title
=
list
[
key
];
btn
.
appendChild
(
txt
);
addEvent
(
btn
,
'
click
'
,
bind
(
pickerInsert
,
list
[
key
],
edid
));
picker
.
appendChild
(
btn
);
var
btn
=
$
(
'
<button>
'
);
btn
.
attr
(
'
class
'
,
'
pickerbutton
'
)
.
attr
(
'
title
'
,
list
[
key
]);
var
txt
=
$
(
document
.
createTextNode
(
list
[
key
]));
btn
.
append
(
txt
);
btn
.
bind
(
'
click
'
,
bind
(
pickerInsert
,
list
[
key
],
edid
));
picker
.
append
(
btn
);
}
else
{
// a list of lists -> treat it as subtoolbar
initToolbar
(
picker
,
edid
,
list
);
...
...
@@ -106,9 +121,11 @@ function createPicker(id,props,edid){
}
}
var
body
=
document
.
getElementsByTagName
(
'
body
'
)[
0
];
body
.
appendChild
(
picker
);
return
picker
;
var
body
=
$
(
'
body
'
);
body
.
append
(
picker
);
// we have to return a javascript object (for compatibility reasons)
return
picker
[
0
];
}
/**
...
...
@@ -132,7 +149,7 @@ function pickerInsert(text,edid){
*/
function
addBtnActionSignature
(
btn
,
props
,
edid
)
{
if
(
typeof
(
SIG
)
!=
'
undefined
'
&&
SIG
!=
''
){
addEvent
(
btn
,
'
click
'
,
bind
(
insertAtCarret
,
edid
,
SIG
));
btn
.
bind
(
'
click
'
,
bind
(
insertAtCarret
,
edid
,
SIG
));
return
true
;
}
return
false
;
...
...
@@ -220,14 +237,14 @@ function keyHandler(e){
//FIXME consolidate somewhere else
addInitEvent
(
function
(){
var
field
=
$
(
'
wiki__text
'
);
if
(
!
field
)
return
;
var
field
=
jQuery
(
'
#
wiki__text
'
);
if
(
field
.
length
==
0
)
return
;
// in Firefox, keypress doesn't send the correct keycodes,
// in Opera, the default of keydown can't be prevented
if
(
is_opera
)
{
addEvent
(
field
,
'
keypress
'
,
keyHandler
);
field
.
bind
(
'
keypress
'
,
keyHandler
);
}
else
{
addEvent
(
field
,
'
keydown
'
,
keyHandler
);
field
.
bind
(
'
keydown
'
,
keyHandler
);
}
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment