Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/AdFabConnect/abejs into r…
Browse files Browse the repository at this point in the history
…eference-editor
  • Loading branch information
wonknu committed Oct 31, 2016
2 parents 8c3a140 + 3ff50b1 commit f1bcc6f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,5 @@ to launch your blog using Abe, under Linux or Mac, you have to set an Environmen

```$ ROOT=/my_path_to_the_blog npm run startdev ```

Other environment variables are available (like PORT for defining a listening port for ABE and WEBPORT for your blog port)

=======
# abe-test-plugin
5 changes: 1 addition & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ program
.option('-p, --port <port>', 'Port on which to listen to (defaults to 8000)', parseInt)
.option('-i, --interactive', 'open in browser')
.option('-N, --pname <pname>', 'pm2 server name')
.option('-w, --webport <webport>', 'website port')
.option('-f, --folder <folder>', '--folder draft|sites')
.option('-t, --type <type>', '--type draft|other')
.option('-d, --destination <destination>', '--destination folder')
Expand All @@ -28,7 +27,6 @@ var userArgs = process.argv.slice(2)
var create = new Create()
var port = program.port
var interactive = program.interactive
var webport = program.webport || 8081

var vPos = process.argv.indexOf('-v')
if (vPos > -1) {
Expand Down Expand Up @@ -169,7 +167,6 @@ if(typeof userArgs[0] !== 'undefined' && userArgs[0] !== null){
}
var environment = process.env
environment.ROOT = dir
environment.WEBPORT = webport
if (typeof port !== 'undefined' && port !== null) {
environment.PORT = port
}
Expand Down Expand Up @@ -207,7 +204,7 @@ if(typeof userArgs[0] !== 'undefined' && userArgs[0] !== null){
break
case 'servenodemon':
dir = process.cwd()
command = 'WEBPORT=' + webport + ' ROOT=' + dir + ' npm run startdev --node-args="--debug"'
command = 'ROOT=' + dir + ' npm run startdev --node-args="--debug"'
if (interactive) command = 'OPENURL=1 ' + command
if(port) command = 'PORT=' + port + ' ' + command
process.chdir(__dirname + '/../')
Expand Down
1 change: 0 additions & 1 deletion src/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ var abePort = null
if(process.env.ROOT) config.set({root: process.env.ROOT.replace(/\/$/, '') + '/'})
if(config.port) abePort = config.port
if(process.env.PORT) abePort = process.env.PORT
config.set({webport: process.env.WEBPORT ? process.env.WEBPORT : 8081})

abeExtend.lock.deleteAll() // delete all process .lock when abe start

Expand Down
33 changes: 17 additions & 16 deletions src/server/public/scripts/modules/EditorAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,24 +79,25 @@ export default class EditorAutocomplete {
}
}

if(typeof nodeComments !== 'undefined' && nodeComments !== null && nodeComments.length > 0) {
var results = [].slice.call(this._currentInput.parentNode.querySelectorAll('.autocomplete-result-wrapper .autocomplete-result'))
var json = this._json.data

json[id] = []
Array.prototype.forEach.call(results, (result) => {
var value = result.getAttribute('value')
if(value !== '') {
if(value.indexOf('{') > -1 || value.indexOf('[') > -1) {
json[id].push(JSON.parse(value))
}else {
json[id].push(value)
}
var results = [].slice.call(this._currentInput.parentNode.querySelectorAll('.autocomplete-result-wrapper .autocomplete-result'))
var json = this._json.data

json[id] = []
Array.prototype.forEach.call(results, (result) => {
var value = result.getAttribute('value')
if(value !== '') {
if(value.indexOf('{') > -1 || value.indexOf('[') > -1) {
json[id].push(JSON.parse(value))
}else {
json[id].push(value)
}
})

this._json.data = json
}
})

this._json.data = json

if(typeof nodeComments !== 'undefined' && nodeComments !== null && nodeComments.length > 0) {

try {
Array.prototype.forEach.call(nodeComments, (nodeComment) => {
var blockHtml = unescape(nodeComment.textContent.replace(/\[\[([\S\s]*?)\]\]/, '')).replace(/\[0\]-/g, '[0]-')
Expand Down
4 changes: 3 additions & 1 deletion src/server/routes/post-sql-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ var route = function(req, res, next){

cmsData.source.requestList(obj, folder, request, jsonPage)
.then(() => {
return res.send(jsonPage[key])

res.set('Content-Type', 'application/json')
res.send(JSON.stringify(jsonPage[key]))
})
}

Expand Down

0 comments on commit f1bcc6f

Please sign in to comment.