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
529881c3
Commit
529881c3
authored
Nov 28, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
传个版本
parent
163a7995
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
157 additions
and
53 deletions
+157
-53
自动合并.jsx
jsx/自动合并.jsx
+0
-49
自动拆分.jsx
jsx/自动拆分.jsx
+62
-0
自动整理.jsx
jsx/自动整理.jsx
+80
-0
common.js
src/api/common.js
+3
-0
config.js
src/config.js
+2
-2
env.js
src/store/modules/env.js
+1
-1
playground.scss
src/themes/light/playground.scss
+4
-0
Assets.vue
src/views/Editor/Assets.vue
+4
-0
DynamicInput.vue
src/views/Editor/behavior-editor/inputs/DynamicInput.vue
+1
-1
No files found.
jsx/自动合并.jsx
deleted
100644 → 0
View file @
163a7995
/**
* Created by rockyl on 2019-11-25.
*/
var
mergeFlagReg
=
/__m$/
;
var
extName
=
'.psd'
;
var
oldDocument
=
app
.
activeDocument
;
var
mergeLayers
=
[];
var
document
=
oldDocument
.
duplicate
(
oldDocument
.
name
.
replace
(
extName
,
''
)
+
'-合并'
+
extName
,
0
);
app
.
activeDocument
=
document
;
merge
(
document
);
function
merge
(
document
){
traverse
(
document
,
function
(
layer
){
return
layer
.
name
.
match
(
mergeFlagReg
);
},
function
(
layer
){
document
.
activeLayer
=
layer
;
var
newName
=
layer
.
name
.
replace
(
mergeFlagReg
,
''
);
layer
.
name
=
newName
;
mergeLayers
.
push
(
newName
);
layer
.
merge
();
});
if
(
mergeLayers
.
length
>
0
){
alert
(
'合并的图层有: '
+
mergeLayers
.
join
(
','
));
}
else
{
alert
(
'没有图层被合并'
);
}
}
function
traverse
(
layer
,
filter
,
callback
)
{
if
(
layer
.
layers
){
for
(
var
i
=
0
;
i
<
layer
.
layers
.
length
;
i
++
)
{
var
childLayer
=
layer
.
layers
[
i
];
if
(
filter
(
childLayer
))
{
callback
(
childLayer
);
}
else
{
traverse
(
childLayer
,
filter
,
callback
);
}
}
}
}
jsx/自动拆分.jsx
0 → 100644
View file @
529881c3
/**
* Created by rockyl on 2019-11-25.
*/
var
curDocument
=
app
.
activeDocument
;
//alert(ShowObjProperty2(curDocument.activeLayer).attributes);
//alert(ShowObjProperty2(oldDocument.activeLayer).methods);
for
(
var
i
=
0
;
i
<
curDocument
.
layers
.
length
;
i
++
)
{
var
layer
=
curDocument
.
layers
[
i
];
if
(
!
layer
.
name
.
match
(
/__e$/
))
{
duplicateToNewDocument
(
layer
);
}
}
function
createDocument
(
width
,
height
,
docName
)
{
//定义一个变量[resolution],表示新文档的分辨率。
var
resolution
=
72
;
//定义一个变量[mode],表示新文档的颜色模式。
var
mode
=
NewDocumentMode
.
RGB
;
//定义一个变量[initialFill],表示新文档的默认背景填充颜色。
var
initialFill
=
DocumentFill
.
TRANSPARENT
;
//定义一个变量[pixelAspectRatio],用来设置新文档的像素比率。
var
pixelAspectRatio
=
1
;
//使用[Documents.add]命令创建一个新文档,将设置好的参数放在[add]方法里面。
var
document
=
app
.
documents
.
add
(
width
,
height
,
resolution
,
docName
,
mode
,
initialFill
,
pixelAspectRatio
);
return
document
;
}
function
duplicateToNewDocument
(
layer
)
{
var
document
=
createDocument
(
curDocument
.
width
,
curDocument
.
height
,
layer
.
name
);
app
.
activeDocument
=
curDocument
;
layer
.
duplicate
(
document
,
ElementPlacement
.
PLACEATBEGINNING
);
}
function
ShowObjProperty2
(
obj
)
{
// 用来保存所有的属性名称和值
var
attributes
=
''
;
var
methods
=
''
;
// 开始遍历
for
(
var
p
in
obj
)
{
// 方法
if
(
typeof
(
obj
[
p
])
===
"function"
)
{
methods
+=
'属性:'
+
p
+
'
\
r
\
n'
// obj[p]();
}
else
{
// p 为属性名称,obj[p]为对应属性的值
attributes
+=
'方法:'
+
p
+
" = "
+
obj
[
p
]
+
"
\
r
\n
"
;
}
}
// 最后显示所有的属性
return
{
attributes
:
attributes
,
methods
:
methods
}
}
jsx/自动整理.jsx
0 → 100644
View file @
529881c3
/**
* Created by rockyl on 2019-11-25.
*/
var
mergeFlagReg
=
/__m$/
;
var
excludeFlagReg
=
/__e$/
;
var
extName
=
'.psd'
;
var
oldDocument
=
app
.
activeDocument
;
var
mergeLayers
=
[];
var
document
=
oldDocument
.
duplicate
(
oldDocument
.
name
.
replace
(
extName
,
''
)
+
'-合并'
+
extName
,
0
);
function
traverse
(
layer
,
callback
)
{
if
(
layer
.
layers
)
{
for
(
var
i
=
0
,
li
=
layer
.
layers
.
length
;
i
<
li
;
i
++
)
{
var
childLayer
=
layer
.
layers
[
i
];
var
action
=
callback
(
childLayer
);
switch
(
action
)
{
case
0
:
traverse
(
childLayer
,
callback
);
break
;
case
2
:
i
--
;
li
--
;
break
;
}
}
}
}
function
deleteDocumentAncestorsMetadata
()
{
whatApp
=
String
(
app
.
name
);
//String version of the app name
if
(
whatApp
.
search
(
"Photoshop"
)
>
0
)
{
//Check for photoshop specifically, or this will cause errors
//Function Scrubs Document Ancestors from Files
if
(
!
documents
.
length
)
{
alert
(
"There are no open documents. Please open a file to run this script."
)
return
;
}
if
(
ExternalObject
.
AdobeXMPScript
==
undefined
)
ExternalObject
.
AdobeXMPScript
=
new
ExternalObject
(
"lib:AdobeXMPScript"
);
var
xmp
=
new
XMPMeta
(
activeDocument
.
xmpMetadata
.
rawData
);
// Begone foul Document Ancestors!
xmp
.
deleteProperty
(
XMPConst
.
NS_PHOTOSHOP
,
"DocumentAncestors"
);
app
.
activeDocument
.
xmpMetadata
.
rawData
=
xmp
.
serialize
();
}
}
function
execute
(
document
)
{
traverse
(
document
,
function
(
layer
)
{
if
(
layer
.
name
.
match
(
mergeFlagReg
))
{
document
.
activeLayer
=
layer
;
var
newName
=
layer
.
name
.
replace
(
mergeFlagReg
,
''
);
layer
.
name
=
newName
;
mergeLayers
.
push
(
newName
);
layer
.
merge
();
return
1
;
}
else
if
(
layer
.
name
.
match
(
excludeFlagReg
))
{
layer
.
remove
();
return
2
;
}
return
0
;
});
deleteDocumentAncestorsMetadata
();
document
.
crop
([
0
,
0
,
oldDocument
.
width
,
oldDocument
.
height
],
0
);
/*if (mergeLayers.length > 0) {
alert('合并的图层有: ' + mergeLayers.join(','));
} else {
alert('没有图层被合并');
}*/
alert
(
'整理完成'
);
}
execute
(
document
);
src/api/common.js
View file @
529881c3
...
...
@@ -49,6 +49,9 @@ export async function fetchApi(uri, {params, method = 'get', contentType = 'json
}
const
response
=
await
fetch
(
url
,
options
);
if
(
response
.
status
===
401
)
{
location
.
href
=
'/admin/permission'
;
}
const
jsonObj
=
await
response
.
json
();
//console.log(jsonObj);
...
...
src/config.js
View file @
529881c3
...
...
@@ -5,9 +5,9 @@
export
let
API_HOST
;
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
//API_HOST = 'http://10.10.95.74:7777';
API_HOST
=
'http://10.10.94.134:7777'
;
//
API_HOST = 'http://10.10.94.134:7777';
//API_HOST = 'http://localhost:3002';
//
API_HOST = window.__data.apiHost;
API_HOST
=
window
.
__data
.
apiHost
;
}
else
{
API_HOST
=
window
.
__data
.
apiHost
;
}
...
...
src/store/modules/env.js
View file @
529881c3
...
...
@@ -11,7 +11,7 @@ export const envStore = {
state
:
{
initialized
:
false
,
name
:
'Zeroing Editor'
,
version
:
'1.0.
0
'
,
version
:
'1.0.
1
'
,
templates
:
{
builtin
:
[
'blank'
],
custom
:
[],
...
...
src/themes/light/playground.scss
View file @
529881c3
...
...
@@ -13,6 +13,10 @@
zoom
:
0
.5
;
background
:
url(data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAiUlEQVQ4jZ1TSxLFIAhLOp7C+19NjyFvlQ7lUUvLRgXzgVGOMQyb6L3/5cwMJAEAxw6sy3FP8tw/EkhJqp7klQMBtKpWcpC1oVp7IoiqviXg4xBFRPL7EM/6WsviYDxwzrkVaBHsz5U4MlWfKxHEySpXIdk6qLRzcXBHVnKQfZRKCy1Ty979XfwApOBe0rB0KiIAAAAASUVORK5CYII=)
;
background-repeat
:
repeat
;
&
:
:-
webkit-scrollbar
{
display
:
none
;
}
}
// .zero-playground-draw-panel{
// min-height: 1200px;
...
...
src/views/Editor/Assets.vue
View file @
529881c3
...
...
@@ -27,6 +27,7 @@
class=
"file-uploader"
:action=
"uploadFileUrl"
name=
"file"
:headers=
"uploadHeaders"
multiple
:show-file-list=
"false"
:on-success=
"uploadFileSuccess"
...
...
@@ -59,6 +60,9 @@
return
{
showFields
:
[
'url'
,
'uuid'
],
currentItem
:
null
,
uploadHeaders
:
{
authorization
:
'Bearer '
+
window
[
'zeroing_token'
],
},
}
},
computed
:
{
...
...
src/views/Editor/behavior-editor/inputs/DynamicInput.vue
View file @
529881c3
<
template
>
<input-wrapper
:editable=
"editable"
:value=
"value"
:container=
"container"
:property=
"property"
:propertyName=
"propertyName"
>
<dynamic-selector
style=
"flex: 1;"
:
input
=
"value"
@
input=
"onChange"
<dynamic-selector
style=
"flex: 1;"
:
value
=
"value"
@
input=
"onChange"
:editable=
"editable"
:container=
"container"
:property=
"property"
...
...
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