Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
9454065a
Commit
9454065a
authored
Oct 17, 2016
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code style and performance fixes
parent
847c8194
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
59 additions
and
56 deletions
+59
-56
editor-codeblock.js
client/js/components/editor-codeblock.js
+23
-21
editor-image.js
client/js/components/editor-image.js
+4
-4
editor.js
client/js/components/editor.js
+20
-20
uploads.js
controllers/uploads.js
+1
-1
ws.js
controllers/ws.js
+1
-1
git.js
libs/git.js
+1
-1
internalAuth.js
libs/internalAuth.js
+1
-1
local.js
libs/local.js
+1
-1
markdown.js
libs/markdown.js
+1
-1
uploads-agent.js
libs/uploads-agent.js
+3
-2
uploads.js
libs/uploads.js
+2
-2
winston.js
libs/winston.js
+1
-1
No files found.
client/js/components/editor-codeblock.js
View file @
9454065a
...
...
@@ -8,6 +8,27 @@ codeEditor.setOption('wrap', true);
let
modelist
=
ace
.
require
(
"ace/ext/modelist"
);
// ACE - Mode Loader
let
modelistLoaded
=
[];
let
loadAceMode
=
(
m
)
=>
{
return
$
.
ajax
({
url
:
'/js/ace/mode-'
+
m
+
'.js'
,
dataType
:
"script"
,
cache
:
true
,
beforeSend
:
()
=>
{
if
(
_
.
includes
(
modelistLoaded
,
m
))
{
return
false
;
}
},
success
:
()
=>
{
modelistLoaded
.
push
(
m
);
}
});
};
// Vue Code Block instance
let
vueCodeBlock
=
new
Vue
({
el
:
'#modal-editor-codeblock'
,
data
:
{
...
...
@@ -39,23 +60,4 @@ let vueCodeBlock = new Vue({
}
}
});
// ACE - Mode Loader
let
modelistLoaded
=
[];
let
loadAceMode
=
(
m
)
=>
{
return
$
.
ajax
({
url
:
'/js/ace/mode-'
+
m
+
'.js'
,
dataType
:
"script"
,
cache
:
true
,
beforeSend
:
()
=>
{
if
(
_
.
includes
(
modelistLoaded
,
m
))
{
return
false
;
}
},
success
:
()
=>
{
modelistLoaded
.
push
(
m
);
}
});
}
\ No newline at end of file
});
\ No newline at end of file
client/js/components/editor-image.js
View file @
9454065a
...
...
@@ -186,7 +186,7 @@ let vueImage = new Vue({
vueImage
.
isLoadingText
=
'Moving image...'
;
vueImage
.
isLoading
=
true
;
Vue
.
nextTick
(()
=>
{
socket
.
emit
(
'uploadsMoveFile'
,
{
uid
:
uid
,
folder
:
fld
},
(
data
)
=>
{
socket
.
emit
(
'uploadsMoveFile'
,
{
uid
,
folder
:
fld
},
(
data
)
=>
{
if
(
data
.
ok
)
{
vueImage
.
loadImages
();
}
else
{
...
...
@@ -311,7 +311,7 @@ let vueImage = new Vue({
position
:
(
opt
,
x
,
y
)
=>
{
$
(
opt
.
$trigger
).
addClass
(
'is-contextopen'
);
let
trigPos
=
$
(
opt
.
$trigger
).
position
();
let
trigDim
=
{
w
:
$
(
opt
.
$trigger
).
width
()
/
2
,
h
:
$
(
opt
.
$trigger
).
height
()
/
2
}
let
trigDim
=
{
w
:
$
(
opt
.
$trigger
).
width
()
/
2
,
h
:
$
(
opt
.
$trigger
).
height
()
/
2
}
;
opt
.
$menu
.
css
({
top
:
trigPos
.
top
+
trigDim
.
h
,
left
:
trigPos
.
left
+
trigDim
.
w
});
},
events
:
{
...
...
@@ -370,7 +370,7 @@ $('#btn-editor-uploadimage input').on('change', (ev) => {
vueImage
.
isLoading
=
true
;
},
progress
:
function
(
progress
)
{
progress
:
(
progress
)
=>
{
vueImage
.
isLoadingText
=
'Uploading...'
+
Math
.
round
(
progress
)
+
'%'
;
},
...
...
@@ -398,7 +398,7 @@ $('#btn-editor-uploadimage input').on('change', (ev) => {
}
},
error
:
function
(
error
)
{
error
:
(
error
)
=>
{
alerts
.
pushError
(
error
.
message
,
this
.
upload
.
file
.
name
);
},
...
...
client/js/components/editor.js
View file @
9454065a
...
...
@@ -10,7 +10,7 @@ if($('#mk-editor').length === 1) {
Vue
.
filter
(
'filesize'
,
(
v
)
=>
{
return
_
.
toUpper
(
filesize
(
v
));
})
})
;
//=include editor-image.js
//=include editor-codeblock.js
...
...
@@ -170,26 +170,26 @@ if($('#mk-editor').length === 1) {
}
});
}
//-> Save
//-> Save
$
(
'.btn-edit-save, .btn-create-save'
).
on
(
'click'
,
(
ev
)
=>
{
$
(
'.btn-edit-save, .btn-create-save'
).
on
(
'click'
,
(
ev
)
=>
{
$
.
ajax
(
window
.
location
.
href
,
{
data
:
{
markdown
:
mde
.
value
()
},
dataType
:
'json'
,
method
:
'PUT'
}).
then
((
rData
,
rStatus
,
rXHR
)
=>
{
if
(
rData
.
ok
)
{
window
.
location
.
assign
(
'/'
+
pageEntryPath
);
}
else
{
alerts
.
pushError
(
'Something went wrong'
,
rData
.
error
);
}
},
(
rXHR
,
rStatus
,
err
)
=>
{
alerts
.
pushError
(
'Something went wrong'
,
'Save operation failed.'
);
});
$
.
ajax
(
window
.
location
.
href
,
{
data
:
{
markdown
:
mde
.
value
()
},
dataType
:
'json'
,
method
:
'PUT'
}).
then
((
rData
,
rStatus
,
rXHR
)
=>
{
if
(
rData
.
ok
)
{
window
.
location
.
assign
(
'/'
+
pageEntryPath
);
}
else
{
alerts
.
pushError
(
'Something went wrong'
,
rData
.
error
);
}
},
(
rXHR
,
rStatus
,
err
)
=>
{
alerts
.
pushError
(
'Something went wrong'
,
'Save operation failed.'
);
});
});
\ No newline at end of file
}
\ No newline at end of file
controllers/uploads.js
View file @
9454065a
...
...
@@ -92,7 +92,7 @@ router.post('/img', lcdata.uploadImgHandler, (req, res, next) => {
return
{
ok
:
false
,
msg
:
r
.
reason
().
message
}
}
;
}
});
res
.
json
({
ok
:
true
,
results
:
uplResults
});
...
...
controllers/ws.js
View file @
9454065a
...
...
@@ -21,7 +21,7 @@ module.exports = (socket) => {
cb
=
cb
||
_
.
noop
;
upl
.
getUploadsFolders
().
then
((
f
)
=>
{
return
cb
(
f
)
||
true
;
})
})
;
});
socket
.
on
(
'uploadsCreateFolder'
,
(
data
,
cb
)
=>
{
...
...
libs/git.js
View file @
9454065a
...
...
@@ -111,7 +111,7 @@ module.exports = {
self
.
_git
.
exec
(
'config'
,
[
'--local'
,
'user.email'
,
self
.
_signature
.
email
])
).
then
(()
=>
{
return
self
.
_git
.
exec
(
'remote'
,
[
'add'
,
'origin'
,
self
.
_url
]);
})
})
;
}
});
...
...
libs/internalAuth.js
View file @
9454065a
...
...
@@ -19,7 +19,7 @@ module.exports = {
generateKey
()
{
return
crypto
.
randomBytes
(
20
).
toString
(
'hex'
)
return
crypto
.
randomBytes
(
20
).
toString
(
'hex'
)
;
},
...
...
libs/local.js
View file @
9454065a
...
...
@@ -47,7 +47,7 @@ module.exports = {
this
.
uploadImgHandler
=
multer
({
storage
:
multer
.
diskStorage
({
destination
:
(
req
,
f
,
cb
)
=>
{
cb
(
null
,
path
.
resolve
(
ROOTPATH
,
appconfig
.
paths
.
data
,
'temp-upload'
))
cb
(
null
,
path
.
resolve
(
ROOTPATH
,
appconfig
.
paths
.
data
,
'temp-upload'
))
;
}
}),
fileFilter
:
(
req
,
f
,
cb
)
=>
{
...
...
libs/markdown.js
View file @
9454065a
...
...
@@ -86,7 +86,7 @@ const parseTree = (content) => {
content
=
heading
.
children
[
1
].
content
;
anchor
=
_
.
kebabCase
(
content
);
}
else
{
content
=
heading
.
content
content
=
heading
.
content
;
anchor
=
_
.
kebabCase
(
heading
.
children
.
reduce
((
acc
,
t
)
=>
acc
+
t
.
content
,
""
));
}
...
...
libs/uploads-agent.js
View file @
9454065a
...
...
@@ -156,7 +156,7 @@ module.exports = {
return
upl
.
watch
();
})
})
;
},
...
...
@@ -218,7 +218,7 @@ module.exports = {
filename
:
f
,
basename
:
fPathObj
.
name
,
filesize
:
s
.
size
}
}
;
// Generate thumbnail
...
...
@@ -258,6 +258,7 @@ module.exports = {
* Generate thumbnail of image
*
* @param {String} sourcePath The source path
* @param {String} destPath The destination path
* @return {Promise<Object>} Promise returning the resized image info
*/
generateThumbnail
(
sourcePath
,
destPath
)
{
...
...
libs/uploads.js
View file @
9454065a
...
...
@@ -95,7 +95,7 @@ module.exports = {
return
db
.
UplFolder
.
findOne
({
name
:
folderName
}).
then
((
f
)
=>
{
return
(
f
)
?
path
.
resolve
(
this
.
_uploadsPath
,
folderName
)
:
false
;
})
})
;
},
...
...
@@ -180,7 +180,7 @@ module.exports = {
let
self
=
this
;
let
fUrlObj
=
url
.
parse
(
fUrl
);
let
fUrlFilename
=
_
.
last
(
_
.
split
(
fUrlObj
.
pathname
,
'/'
))
let
fUrlFilename
=
_
.
last
(
_
.
split
(
fUrlObj
.
pathname
,
'/'
))
;
let
destFolder
=
_
.
chain
(
fFolder
).
trim
().
toLower
().
value
();
return
upl
.
validateUploadsFolder
(
destFolder
).
then
((
destFolderPath
)
=>
{
...
...
libs/winston.js
View file @
9454065a
...
...
@@ -4,7 +4,7 @@ var winston = require('winston');
module
.
exports
=
(
isDebug
)
=>
{
winston
.
remove
(
winston
.
transports
.
Console
)
winston
.
remove
(
winston
.
transports
.
Console
)
;
winston
.
add
(
winston
.
transports
.
Console
,
{
level
:
(
isDebug
)
?
'info'
:
'warn'
,
prettyPrint
:
true
,
...
...
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