1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 05:09:42 +02:00

Provide Bash/Shell code syntax in Rich Text Editor

Closes #322
This commit is contained in:
sauls8t 2019-09-18 11:25:21 +01:00
parent 00889f0e0e
commit 6b723568d3
4 changed files with 119 additions and 42 deletions

View file

@ -1334,6 +1334,7 @@ func (h *Handler) FetchPages(w http.ResponseWriter, r *http.Request) {
documentID := request.Param(r, "documentID") documentID := request.Param(r, "documentID")
if len(documentID) == 0 { if len(documentID) == 0 {
response.WriteMissingDataError(w, method, "documentID") response.WriteMissingDataError(w, method, "documentID")
h.Runtime.Log.Infof("Document ID missing for org %s", ctx.OrgID)
return return
} }
@ -1343,7 +1344,7 @@ func (h *Handler) FetchPages(w http.ResponseWriter, r *http.Request) {
doc, err := h.Store.Document.Get(ctx, documentID) doc, err := h.Store.Document.Get(ctx, documentID)
if err != nil { if err != nil {
response.WriteServerError(w, method, err) response.WriteServerError(w, method, err)
h.Runtime.Log.Error(method, err) h.Runtime.Log.Infof("Document not found %s", documentID)
return return
} }

View file

@ -75,6 +75,7 @@ export default Component.extend({
{ text: 'Fsharp', value: 'fsharp' }, { text: 'Fsharp', value: 'fsharp' },
{ text: 'Git', value: 'git' }, { text: 'Git', value: 'git' },
{ text: 'Go', value: 'go' }, { text: 'Go', value: 'go' },
{ text: 'GraphQL', value: 'graphql' },
{ text: 'Haskell', value: 'haskell' }, { text: 'Haskell', value: 'haskell' },
{ text: 'HTML', value: 'markup' }, { text: 'HTML', value: 'markup' },
{ text: 'HTTP', value: 'http' }, { text: 'HTTP', value: 'http' },
@ -93,6 +94,7 @@ export default Component.extend({
{ text: 'Ruby', value: 'ruby' }, { text: 'Ruby', value: 'ruby' },
{ text: 'Rust', value: 'rust' }, { text: 'Rust', value: 'rust' },
{ text: 'Sass SCSS', value: 'scss' }, { text: 'Sass SCSS', value: 'scss' },
{ text: 'Shell', value: 'bash' },
{ text: 'SQL', value: 'sql' }, { text: 'SQL', value: 'sql' },
{ text: 'Swift', value: 'swift' }, { text: 'Swift', value: 'swift' },
{ text: 'TypeScript', value: 'typescript' }, { text: 'TypeScript', value: 'typescript' },

View file

@ -1,5 +1,5 @@
/* PrismJS 1.15.0 /* PrismJS 1.17.1
https://prismjs.com/download.html?#themes=prism-solarizedlight&languages=markup+css+clike+javascript+c+csharp+cpp+coffeescript+ruby+docker+elixir+markup-templating+erlang+fsharp+git+go+less+handlebars+haskell+http+java+json+markdown+makefile+nginx+objectivec+perl+php+sql+powershell+scss+python+jsx+typescript+rust+swift+yaml&plugins=line-numbers */ https://prismjs.com/download.html#themes=prism-solarizedlight&languages=markup+css+clike+javascript+c+csharp+bash+cpp+aspnet+coffeescript+clojure+ruby+markup-templating+docker+elixir+erlang+fsharp+git+go+graphql+less+handlebars+haskell+http+java+php+markdown+json+latex+makefile+typescript+nginx+objectivec+perl+sql+powershell+scss+python+jsx+rust+plsql+swift+yaml+toml+regex+wasm&plugins=line-numbers+toolbar+highlight-keywords+show-language */
/* /*
Solarized Color Schemes originally by Ethan Schoonover Solarized Color Schemes originally by Ethan Schoonover
http://ethanschoonover.com/solarized http://ethanschoonover.com/solarized
@ -34,6 +34,7 @@ code[class*="language-"],
pre[class*="language-"] { pre[class*="language-"] {
color: #657b83; /* base00 */ color: #657b83; /* base00 */
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
font-size: 1em;
text-align: left; text-align: left;
white-space: pre; white-space: pre;
word-spacing: normal; word-spacing: normal;
@ -192,3 +193,68 @@ pre[class*="language-"].line-numbers > code {
text-align: right; text-align: right;
} }
div.code-toolbar {
position: relative;
}
div.code-toolbar > .toolbar {
position: absolute;
top: .3em;
right: .2em;
transition: opacity 0.3s ease-in-out;
opacity: 0;
}
div.code-toolbar:hover > .toolbar {
opacity: 1;
}
/* Separate line b/c rules are thrown out if selector is invalid.
IE11 and old Edge versions don't support :focus-within. */
div.code-toolbar:focus-within > .toolbar {
opacity: 1;
}
div.code-toolbar > .toolbar .toolbar-item {
display: inline-block;
}
div.code-toolbar > .toolbar a {
cursor: pointer;
}
div.code-toolbar > .toolbar button {
background: none;
border: 0;
color: inherit;
font: inherit;
line-height: normal;
overflow: visible;
padding: 0;
-webkit-user-select: none; /* for button */
-moz-user-select: none;
-ms-user-select: none;
}
div.code-toolbar > .toolbar a,
div.code-toolbar > .toolbar button,
div.code-toolbar > .toolbar span {
color: #bbb;
font-size: .8em;
padding: 0 .5em;
background: #f5f2f0;
background: rgba(224, 224, 224, 0.2);
box-shadow: 0 2px 0 0 rgba(0,0,0,0.2);
border-radius: .5em;
}
div.code-toolbar > .toolbar a:hover,
div.code-toolbar > .toolbar a:focus,
div.code-toolbar > .toolbar button:hover,
div.code-toolbar > .toolbar button:focus,
div.code-toolbar > .toolbar span:hover,
div.code-toolbar > .toolbar span:focus {
color: inherit;
text-decoration: none;
}

File diff suppressed because one or more lines are too long