summaryrefslogtreecommitdiff
path: root/public/js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js')
-rw-r--r--public/js/extra.js17
-rw-r--r--public/js/index.js5
2 files changed, 19 insertions, 3 deletions
diff --git a/public/js/extra.js b/public/js/extra.js
index 7a1077d5..ddec31a8 100644
--- a/public/js/extra.js
+++ b/public/js/extra.js
@@ -834,7 +834,7 @@ const anchorForId = id => {
const anchor = document.createElement('a')
anchor.className = 'anchor hidden-xs'
anchor.href = `#${id}`
- anchor.innerHTML = '<span class="octicon octicon-link"></span>'
+ anchor.innerHTML = '<i class="fa fa-link"></i>'
anchor.title = id
return anchor
}
@@ -1145,6 +1145,20 @@ const pdfPlugin = new Plugin(
}
)
+const emojijsPlugin = new Plugin(
+ // regexp to match emoji shortcodes :something:
+ /:([\d\D]*):/,
+
+ (match, utils) => {
+ const emoji = match[1] ? match[1].toLowerCase() : undefined
+ if (window.emojify.emojiNames.includes(emoji)) {
+ const div = $(`<img class="emoji" src="${serverurl}/build/emojify.js/dist/images/basic/${emoji}.png"></img>`)
+ return div[0].outerHTML
+ }
+ return match[0]
+ }
+)
+
// yaml meta, from https://github.com/eugeneware/remarkable-meta
function get (state, line) {
const pos = state.bMarks[line]
@@ -1189,6 +1203,7 @@ function metaPlugin (md) {
}
md.use(metaPlugin)
+md.use(emojijsPlugin)
md.use(youtubePlugin)
md.use(vimeoPlugin)
md.use(gistPlugin)
diff --git a/public/js/index.js b/public/js/index.js
index 1330deac..98c3b6d2 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -17,6 +17,7 @@ import toMarkdown from 'to-markdown'
import { saveAs } from 'file-saver'
import randomColor from 'randomcolor'
import store from 'store'
+import hljs from 'highlight.js'
import _ from 'lodash'
@@ -92,7 +93,7 @@ var cursorMenuThrottle = 50
var cursorActivityDebounce = 50
var cursorAnimatePeriod = 100
var supportContainers = ['success', 'info', 'warning', 'danger']
-var supportCodeModes = ['javascript', 'typescript', 'jsx', 'htmlmixed', 'htmlembedded', 'css', 'xml', 'clike', 'clojure', 'ruby', 'python', 'shell', 'php', 'sql', 'haskell', 'coffeescript', 'yaml', 'pug', 'lua', 'cmake', 'nginx', 'perl', 'sass', 'r', 'dockerfile', 'tiddlywiki', 'mediawiki', 'go', 'gherkin']
+var supportCodeModes = ['javascript', 'typescript', 'jsx', 'htmlmixed', 'htmlembedded', 'css', 'xml', 'clike', 'clojure', 'ruby', 'python', 'shell', 'php', 'sql', 'haskell', 'coffeescript', 'yaml', 'pug', 'lua', 'cmake', 'nginx', 'perl', 'sass', 'r', 'dockerfile', 'tiddlywiki', 'mediawiki', 'go', 'gherkin'].concat(hljs.listLanguages())
var supportCharts = ['sequence', 'flow', 'graphviz', 'mermaid', 'abc']
var supportHeaders = [
{
@@ -1479,7 +1480,7 @@ $('#snippetExportModalConfirm').click(function () {
file_name: $('#snippetExportModalFileName').val(),
code: editor.getValue(),
visibility_level: $('#snippetExportModalVisibility').val(),
- visibility: $('#snippetExportModalVisibility').val() === 0 ? 'private' : ($('#snippetExportModalVisibility').val() === 10 ? 'internal' : '')
+ visibility: $('#snippetExportModalVisibility').val() === '0' ? 'private' : ($('#snippetExportModalVisibility').val() === '10' ? 'internal' : 'private')
}
if (!data.title || !data.file_name || !data.code || !data.visibility_level || !$('#snippetExportModalProjects').val()) return