Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-editor
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-editor
Commits
0b3a1a94
Commit
0b3a1a94
authored
Dec 03, 2019
by
任建锋
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into rjf_test
parents
1cc13b2d
73794e8c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
29 deletions
+53
-29
template.js
src/template.js
+1
-2
index.js
src/utils/index.js
+12
-0
properties.js
src/utils/properties.js
+7
-0
Editor.vue
src/views/Editor.vue
+18
-18
MetaEditorDialog.vue
src/views/Editor/behavior-editor/MetaEditorDialog.vue
+13
-6
PackResultDialog.vue
src/views/Editor/dialogs/PackResultDialog.vue
+2
-3
No files found.
src/template.js
View file @
0b3a1a94
...
@@ -34,8 +34,7 @@ content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, u
...
@@ -34,8 +34,7 @@ content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, u
<body>
<body>
<div id="$CONTAINER_ID$" style="line-height:0;font-size:0"></div>
<div id="$CONTAINER_ID$" style="line-height:0;font-size:0"></div>
<script src="
${
process
.
env
.
NODE_ENV
===
'development'
?
'http://10.10.94.134:4002/dist/index.js'
:
'http://yun.duiba.com.cn/editor/zeroing/libs/engine.b0b81ba7872b4ffaa3cdbe5d440cdb4617b86c5c.js'
}
"></script>
<script src="
${
process
.
env
.
NODE_ENV
===
'development'
?
'http://10.10.94.134:4002/dist/index.js'
:
'http://yun.duiba.com.cn/editor/zeroing/libs/engine.a913456caee2ee40c20108a1c4571f61479e54a1.js'
}
"></script>
<script src="http://yun.duiba.com.cn/editor/zeroing/libs/tslib.js"></script>
<script src="$PROCESSES_URL$"></script>
<script src="$PROCESSES_URL$"></script>
<script src="$SCRIPTS_URL$"></script>
<script src="$SCRIPTS_URL$"></script>
<script src="$CUSTOMS_URL$"></script>
<script src="$CUSTOMS_URL$"></script>
...
...
src/utils/index.js
View file @
0b3a1a94
...
@@ -130,3 +130,15 @@ export function selectFile(callback, {accept, multiple} = {}) {
...
@@ -130,3 +130,15 @@ export function selectFile(callback, {accept, multiple} = {}) {
}
}
input
.
click
();
input
.
click
();
}
}
export
function
openPreview
(
packResult
){
setTimeout
(()
=>
{
let
url
;
if
(
location
.
host
.
startsWith
(
'localhost'
)){
url
=
packResult
.
tplUrl
;
}
else
{
url
=
'/preview?url=http:'
+
packResult
.
tplUrl
;
}
window
.
open
(
url
,
'blank'
);
},
500
);
}
src/utils/properties.js
View file @
0b3a1a94
...
@@ -260,5 +260,12 @@ export default {
...
@@ -260,5 +260,12 @@ export default {
type
:
'inputNumber'
,
type
:
'inputNumber'
,
value
:
20
,
value
:
20
,
},
},
},
htmlView
:
{
groupName
:
'HTML视图'
,
htmlElement
:
{
title
:
'HTML内容'
,
type
:
'input'
,
},
}
}
}
}
src/views/Editor.vue
View file @
0b3a1a94
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
import
Playground
from
"./Editor/Playground"
;
import
Playground
from
"./Editor/Playground"
;
import
Assets
from
"./Editor/Assets"
;
import
Assets
from
"./Editor/Assets"
;
import
DetailsDialog
from
"./Editor/dialogs/DetailsDialog"
;
import
DetailsDialog
from
"./Editor/dialogs/DetailsDialog"
;
import
{
playWaiting
}
from
"../utils"
;
import
{
openPreview
,
playWaiting
}
from
"../utils"
;
import
i18n
from
"../i18n"
;
import
i18n
from
"../i18n"
;
import
PackResultDialog
from
"./Editor/dialogs/PackResultDialog"
;
import
PackResultDialog
from
"./Editor/dialogs/PackResultDialog"
;
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
},
},
watch
:
{
watch
:
{
$route
:
{
$route
:
{
handler
:
function
(
val
,
oldVal
)
{
handler
:
function
(
val
,
oldVal
)
{
console
.
log
(
'router changed'
);
console
.
log
(
'router changed'
);
this
.
loadProject
();
this
.
loadProject
();
},
},
...
@@ -63,21 +63,22 @@
...
@@ -63,21 +63,22 @@
async
mounted
()
{
async
mounted
()
{
document
.
addEventListener
(
'keydown'
,
this
.
onKeyPress
);
document
.
addEventListener
(
'keydown'
,
this
.
onKeyPress
);
await
playWaiting
(
this
.
prepare
(),
this
.
$t
(
'Preparing'
)).
catch
(
e
=>
{});
await
playWaiting
(
this
.
prepare
(),
this
.
$t
(
'Preparing'
)).
catch
(
e
=>
{
});
this
.
loadProject
();
this
.
loadProject
();
},
},
destroyed
(){
destroyed
()
{
document
.
removeEventListener
(
'keydown'
,
this
.
onKeyPress
)
document
.
removeEventListener
(
'keydown'
,
this
.
onKeyPress
)
},
},
methods
:
{
methods
:
{
prepare
(){
prepare
()
{
return
Promise
.
all
([
return
Promise
.
all
([
this
.
updateEnv
(),
this
.
updateEnv
(),
])
])
},
},
onKeyPress
(
e
){
onKeyPress
(
e
)
{
if
(
e
.
key
===
's'
&&
(
e
.
ctrlKey
||
e
.
metaKey
))
{
if
(
e
.
key
===
's'
&&
(
e
.
ctrlKey
||
e
.
metaKey
))
{
e
.
preventDefault
();
e
.
preventDefault
();
this
.
saveProject
();
this
.
saveProject
();
...
@@ -85,7 +86,7 @@
...
@@ -85,7 +86,7 @@
return
false
;
return
false
;
}
}
},
},
async
loadProject
(){
async
loadProject
()
{
const
{
projectID
}
=
this
.
$route
.
params
;
const
{
projectID
}
=
this
.
$route
.
params
;
if
(
await
this
.
localVersionExist
(
projectID
))
{
if
(
await
this
.
localVersionExist
(
projectID
))
{
this
.
$confirm
(
this
.
$t
(
'Unsaved version found locally'
),
this
.
$t
(
'Alert'
),
{
this
.
$confirm
(
this
.
$t
(
'Unsaved version found locally'
),
this
.
$t
(
'Alert'
),
{
...
@@ -111,7 +112,7 @@
...
@@ -111,7 +112,7 @@
loadLocalVersion
(
projectID
)
{
loadLocalVersion
(
projectID
)
{
this
.
ready
=
false
;
this
.
ready
=
false
;
this
.
loadFromLocal
(
projectID
);
this
.
loadFromLocal
(
projectID
);
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
ready
=
true
;
this
.
ready
=
true
;
});
});
},
},
...
@@ -121,7 +122,7 @@
...
@@ -121,7 +122,7 @@
await
playWaiting
(
this
.
loadFromRemote
(
projectID
),
this
.
$t
(
'Preparing'
)).
catch
(
e
=>
{
await
playWaiting
(
this
.
loadFromRemote
(
projectID
),
this
.
$t
(
'Preparing'
)).
catch
(
e
=>
{
this
.
$alert
(
this
.
$t
(
'Project does not exist'
),
this
.
$t
(
'Alert'
),
{
this
.
$alert
(
this
.
$t
(
'Project does not exist'
),
this
.
$t
(
'Alert'
),
{
confirmButtonText
:
this
.
$t
(
'Confirm'
),
confirmButtonText
:
this
.
$t
(
'Confirm'
),
callback
:
action
=>
{
callback
:
action
=>
{
this
.
$router
.
replace
({
name
:
'home'
});
this
.
$router
.
replace
({
name
:
'home'
});
}
}
});
});
...
@@ -191,23 +192,22 @@
...
@@ -191,23 +192,22 @@
break
;
break
;
}
}
},
},
async
pack
(
debug
=
false
){
async
pack
(
debug
=
false
)
{
const
loading
=
this
.
$loading
({
const
loading
=
this
.
$loading
({
lock
:
true
,
lock
:
true
,
text
:
this
.
$t
(
'Packing'
),
text
:
this
.
$t
(
'Packing'
),
});
});
try
{
try
{
await
this
.
saveProject
(
false
);
await
this
.
saveProject
(
false
);
const
packResult
=
await
this
.
packProject
(
debug
);
const
packResult
=
await
this
.
packProject
(
debug
);
this
.
$message
({
this
.
$message
({
message
:
this
.
$t
(
'Pack project successfully'
),
message
:
this
.
$t
(
'Pack project successfully'
),
type
:
'success'
,
type
:
'success'
,
duration
:
10
00
,
duration
:
5
00
,
});
});
if
(
debug
){
setTimeout
(()
=>
{
if
(
debug
)
{
window
.
open
(
packResult
.
tplUrl
,
'blank'
);
openPreview
(
packResult
);
},
500
);
}
else
{
}
else
{
this
.
$refs
.
packResultDialog
.
show
(
packResult
);
this
.
$refs
.
packResultDialog
.
show
(
packResult
);
}
}
/*this.$confirm(this.$t('Pack project successfully'), this.$t('Alert'), {
/*this.$confirm(this.$t('Pack project successfully'), this.$t('Alert'), {
...
@@ -221,7 +221,7 @@
...
@@ -221,7 +221,7 @@
}).catch(() => {
}).catch(() => {
});*/
});*/
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
$message
({
this
.
$message
({
message
:
this
.
$t
(
'Pack project failed'
),
message
:
this
.
$t
(
'Pack project failed'
),
type
:
'error'
,
type
:
'error'
,
...
...
src/views/Editor/behavior-editor/MetaEditorDialog.vue
View file @
0b3a1a94
<
template
>
<
template
>
<el-dialog
:title=
"$t('Meta Editor')"
width=
"80%"
:visible
.
sync=
"visible"
<el-dialog
:title=
"$t('Meta Editor')"
width=
"80%"
:visible
.
sync=
"visible"
:close-on-click-modal=
"false"
:close-on-click-modal=
"false"
:close-on-press-escape=
"false"
:show-close=
"false"
:append-to-body=
"true"
>
:append-to-body=
"true"
>
<div
class=
"meta-editor-wrapper"
>
<div
class=
"meta-editor-wrapper"
>
<el-form
ref=
"form"
v-if=
"meta"
:model=
"meta"
:rules=
"rules"
:show-message=
"false"
class=
"info-editor"
size=
"mini"
label-position=
"right"
label-width=
"70px"
@
submit
.
native
.
prevent
>
<el-form
ref=
"form"
v-if=
"meta"
:model=
"meta"
:rules=
"rules"
:show-message=
"false"
class=
"info-editor"
size=
"mini"
label-position=
"right"
label-width=
"70px"
@
submit
.
native
.
prevent
>
...
@@ -41,9 +43,12 @@
...
@@ -41,9 +43,12 @@
</div>
</div>
<!--<el-input v-if="meta" class="script-editor" :readonly=" !editable" type="textarea" :placeholder="$t('Code')"
<!--<el-input v-if="meta" class="script-editor" :readonly=" !editable" type="textarea" :placeholder="$t('Code')"
v-model="meta.script"></el-input>-->
v-model="meta.script"></el-input>-->
<codemirror
ref=
"
myCm
"
v-if=
"meta"
<codemirror
ref=
"
codeEditor
"
v-if=
"meta"
v-model=
"meta.script"
v-model=
"meta.script"
:options=
"cmOptions"
>
:options=
"cmOptions"
@
cursorActivity=
"onCodeChange"
>
</codemirror>
</codemirror>
</div>
</div>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
@@ -73,6 +78,9 @@
...
@@ -73,6 +78,9 @@
import
'codemirror/lib/codemirror.css'
import
'codemirror/lib/codemirror.css'
import
'codemirror/theme/monokai.css'
import
'codemirror/theme/monokai.css'
import
'codemirror/addon/edit/closebrackets.js'
import
'codemirror/addon/edit/closebrackets.js'
import
'codemirror/addon/hint/show-hint.js'
import
'codemirror/addon/hint/show-hint.css'
import
'codemirror/addon/hint/javascript-hint.js'
const
exposeVariables
=
[
'args'
,
'props'
,
'target'
,
'global'
,
'vm'
,
'engine'
];
const
exposeVariables
=
[
'args'
,
'props'
,
'target'
,
'global'
,
'vm'
,
'engine'
];
...
@@ -95,7 +103,6 @@
...
@@ -95,7 +103,6 @@
],
],
},
},
cmOptions
:
{
cmOptions
:
{
// codemirror options
tabSize
:
2
,
tabSize
:
2
,
mode
:
'text/javascript'
,
mode
:
'text/javascript'
,
styleActiveLine
:
true
,
styleActiveLine
:
true
,
...
@@ -104,7 +111,6 @@
...
@@ -104,7 +111,6 @@
line
:
true
,
line
:
true
,
matchBrackets
:
true
,
matchBrackets
:
true
,
autoCloseBrackets
:
true
,
autoCloseBrackets
:
true
,
// more codemirror options, 更多 codemirror 的高级配置...
}
}
}
}
},
},
...
@@ -167,8 +173,9 @@
...
@@ -167,8 +173,9 @@
focusPasteBoard
(){
focusPasteBoard
(){
this
.
$refs
.
pasteBoard
.
focus
();
this
.
$refs
.
pasteBoard
.
focus
();
},
},
onCmCodeChange
(
code
){
onCodeChange
(
codemirror
){
console
.
log
(
code
);
//codemirror.showHint();
//console.log(code);
}
}
}
}
}
}
...
...
src/views/Editor/dialogs/PackResultDialog.vue
View file @
0b3a1a94
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
<
script
>
<
script
>
import
copy
from
'copy-to-clipboard'
import
copy
from
'copy-to-clipboard'
import
{
openPreview
}
from
"../../../utils"
;
export
default
{
export
default
{
name
:
"PackResultDialog"
,
name
:
"PackResultDialog"
,
...
@@ -40,9 +41,7 @@
...
@@ -40,9 +41,7 @@
openInNewTab
()
{
openInNewTab
()
{
this
.
visible
=
false
;
this
.
visible
=
false
;
setTimeout
(()
=>
{
openPreview
(
this
.
packResult
);
window
.
open
(
this
.
packResult
.
tplUrl
,
'blank'
);
},
500
);
},
},
copy
()
{
copy
()
{
this
.
visible
=
false
;
this
.
visible
=
false
;
...
...
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