Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
epoc-editor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
learninglab
epoc
epoc-editor
Commits
a51cd5cb
Commit
a51cd5cb
authored
1 year ago
by
VIAUD Nathan
Browse files
Options
Downloads
Patches
Plain Diff
fix: normalize assets between posix & windows
parent
06927267
No related branches found
No related tags found
1 merge request
!97
Resolve "WYSIWYG Images not normalized between windows & posix"
Pipeline
#895251
passed
1 year ago
Stage: build
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
electron/components/file.js
+2
-3
2 additions, 3 deletions
electron/components/file.js
electron/components/main.js
+14
-3
14 additions, 3 deletions
electron/components/main.js
src/features/forms/components/inputs/FileInput.vue
+5
-1
5 additions, 1 deletion
src/features/forms/components/inputs/FileInput.vue
with
21 additions
and
7 deletions
electron/components/file.js
+
2
−
3
View file @
a51cd5cb
...
@@ -261,7 +261,7 @@ const copyFileToWorkdir = async function (workdir, filepath, isIcon) {
...
@@ -261,7 +261,7 @@ const copyFileToWorkdir = async function (workdir, filepath, isIcon) {
const
copyPath
=
path
.
join
(
assetsPath
,
path
.
basename
(
filepath
).
replace
(
/
[^
a-z0-9.
]
/gi
,
'
_
'
));
const
copyPath
=
path
.
join
(
assetsPath
,
path
.
basename
(
filepath
).
replace
(
/
[^
a-z0-9.
]
/gi
,
'
_
'
));
if
(
!
fs
.
existsSync
(
assetsPath
))
fs
.
mkdirSync
(
assetsPath
);
if
(
!
fs
.
existsSync
(
assetsPath
))
fs
.
mkdirSync
(
assetsPath
);
fs
.
copyFileSync
(
filepath
,
copyPath
);
fs
.
copyFileSync
(
filepath
,
copyPath
);
return
path
.
relative
(
workdir
,
copyPath
);
return
path
.
relative
(
workdir
,
copyPath
)
.
replaceAll
(
'
\\
'
,
'
/
'
)
;
};
};
/**
/**
...
@@ -345,7 +345,7 @@ const getUsedAssets = function (workdir) {
...
@@ -345,7 +345,7 @@ const getUsedAssets = function (workdir) {
if
(
!
matches
)
return
[];
if
(
!
matches
)
return
[];
return
matches
.
map
(
match
=>
{
return
matches
.
map
(
match
=>
{
return
match
.
replace
(
`
assets
${
path
.
sep
}
`
,
''
)
return
match
.
replace
(
'
assets
/
'
,
''
)
.
replaceAll
(
'
"
'
,
''
)
.
replaceAll
(
'
"
'
,
''
)
// To only keep the slash after icons
// To only keep the slash after icons
.
replace
(
/
\/
+/g
,
'
/
'
)
.
replace
(
/
\/
+/g
,
'
/
'
)
...
@@ -363,7 +363,6 @@ const getUnusedAssets = function (workdir) {
...
@@ -363,7 +363,6 @@ const getUnusedAssets = function (workdir) {
unusedAssets
.
push
(
asset
);
unusedAssets
.
push
(
asset
);
}
}
}
}
console
.
assert
(
unusedAssets
.
length
===
0
,
'
parasite asset detected
'
,
unusedAssets
);
return
unusedAssets
;
return
unusedAssets
;
};
};
...
...
This diff is collapsed.
Click to expand it.
electron/components/main.js
+
14
−
3
View file @
a51cd5cb
...
@@ -60,15 +60,26 @@ module.exports.setupWindow = function (window) {
...
@@ -60,15 +60,26 @@ module.exports.setupWindow = function (window) {
console
.
error
(
'
Failed to register protocol:
'
,
error
);
console
.
error
(
'
Failed to register protocol:
'
,
error
);
}
}
const
windowsUrl
=
[
`file:///
${
encodeURI
(
path
.
join
(
__dirname
,
'
../../dist/assets/
'
).
replaceAll
(
'
\\
'
,
'
/
'
))}
*`
,
`file:///
${
encodeURI
(
path
.
join
(
__dirname
,
'
../../dist/images/
'
).
replaceAll
(
'
\\
'
,
'
/
'
))}
*`
,
`file:///
${
encodeURI
(
path
.
join
(
__dirname
,
'
../../dist/videos/
'
).
replaceAll
(
'
\\
'
,
'
/
'
))}
*`
,
];
const
posixUrl
=
[
`file://
${
encodeURI
(
path
.
join
(
__dirname
,
'
../../dist/assets/
'
))}
*`
,
`file://
${
encodeURI
(
path
.
join
(
__dirname
,
'
../../dist/images/
'
))}
*`
,
`file://
${
encodeURI
(
path
.
join
(
__dirname
,
'
../../dist/videos/
'
))}
*`
,
];
// Intercept all url starting with assets/ and redirect it to custom protocol (wysiwyg/quill)
// Intercept all url starting with assets/ and redirect it to custom protocol (wysiwyg/quill)
const
filter
=
{
const
filter
=
{
urls
:
[
urls
:
[
'
http://localhost:8000/assets/*
'
,
'
http://localhost:8000/assets/*
'
,
'
http://localhost:8000/images/*
'
,
'
http://localhost:8000/images/*
'
,
'
http://localhost:8000/videos/*
'
,
'
http://localhost:8000/videos/*
'
,
`file://
${
encodeURI
(
path
.
join
(
__dirname
,
'
../../dist/assets/
'
))}
*`
,
`file://
${
encodeURI
(
path
.
join
(
__dirname
,
'
../../dist/images/
'
))}
*`
,
...(
process
.
platform
===
'
win32
'
?
windowsUrl
:
posixUrl
)
`file://
${
encodeURI
(
path
.
join
(
__dirname
,
'
../../dist/videos/
'
))}
*`
]
]
};
};
...
...
This diff is collapsed.
Click to expand it.
src/features/forms/components/inputs/FileInput.vue
+
5
−
1
View file @
a51cd5cb
...
@@ -26,7 +26,6 @@ const filetype = computed(() => {
...
@@ -26,7 +26,6 @@ const filetype = computed(() => {
return
null
;
return
null
;
});
});
//! This function have to fetch the image from the back
async
function
changeImage
(
e
:
Event
)
{
async
function
changeImage
(
e
:
Event
)
{
savedState
=
getCurrentState
(
true
);
savedState
=
getCurrentState
(
true
);
...
@@ -56,6 +55,11 @@ function openFile() {
...
@@ -56,6 +55,11 @@ function openFile() {
onMounted
(()
=>
{
onMounted
(()
=>
{
url
.
value
=
props
.
inputValue
;
url
.
value
=
props
.
inputValue
;
if
(
url
.
value
.
includes
(
'
\\
'
))
{
//? Backwards support if files contains backslashes (not possible anymore)
// TODO: Remove this in the future
emit
(
'
input
'
,
url
.
value
.
replaceAll
(
'
\\
'
,
'
/
'
));
}
});
});
watch
(
watch
(
...
...
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