Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cribjs-editor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
cribjs-editor
Commits
06fd9e9d
Commit
06fd9e9d
authored
Sep 22, 2020
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Editor: Add Mimetype guess
parent
594a96c5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
gadget/gadget_cribjs_page_editor.html
gadget/gadget_cribjs_page_editor.html
+1
-0
gadget/gadget_cribjs_page_editor.js
gadget/gadget_cribjs_page_editor.js
+8
-2
No files found.
gadget/gadget_cribjs_page_editor.html
View file @
06fd9e9d
...
...
@@ -9,6 +9,7 @@
<script
src=
"../lib/rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/jio-latest.js"
type=
"text/javascript"
></script>
<script
src=
"../lib/mimetype.js"
type=
"text/javascript"
></script>
<script
src=
"./gadget_global.js"
type=
"text/javascript"
></script>
<!-- Custom -->
...
...
gadget/gadget_cribjs_page_editor.js
View file @
06fd9e9d
/*global window, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3*/
(
function
(
window
,
rJS
,
loopEventListener
,
jIO
)
{
(
function
(
window
,
rJS
,
loopEventListener
,
jIO
,
mimeType
)
{
"
use strict
"
;
var
CODE_CONTENT_KEY
=
"
text_content
"
;
...
...
@@ -9,6 +9,9 @@
var
content
,
url
=
gadget
.
props
.
element
.
querySelector
(
"
form.crib-editor-get .url
"
).
value
,
mimetype
=
gadget
.
props
.
element
.
querySelector
(
"
form.crib-editor-save .mimetype
"
).
value
;
if
(
!
mimetype
)
{
mimetype
=
mimeType
.
lookup
(
url
,
false
,
"
application/octet-stream
"
);
}
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
codeeditor
'
);
...
...
@@ -34,6 +37,9 @@
})
.
push
(
function
(
data
)
{
type
=
data
.
type
;
if
(
!
type
||
type
===
"
application/octet-stream
"
)
{
type
=
mimeType
.
lookup
(
url
,
false
,
"
application/octet-stream
"
);
}
return
jIO
.
util
.
readBlobAsText
(
data
,
type
);
})
.
push
(
function
(
evt
)
{
...
...
@@ -128,4 +134,4 @@
return
RSVP
.
all
(
promise_list
);
});
});
}(
window
,
rJS
,
loopEventListener
,
jIO
));
\ No newline at end of file
}(
window
,
rJS
,
loopEventListener
,
jIO
,
mimeType
));
\ No newline at end of file
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