Skip to content

Commit f4e726a

Browse files
authored
Merge pull request #251 from codeitcodes/patch-1
Patch 1
2 parents 0ff0737 + 10056d9 commit f4e726a

File tree

6 files changed

+72
-41
lines changed

6 files changed

+72
-41
lines changed

dark-theme.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ cd-el {
133133
.token.atrule,
134134
.token.url .token.content,
135135
.token.url-reference .token.variable,
136-
.language-markdown .token.code-block .token.punctuation {
136+
.language-markdown .token.code-block .token.punctuation,
137+
.language-markdown .token.tag .token.punctuation {
137138
color: #a6c3d4;
138139
}
139140

@@ -240,6 +241,10 @@ cd-el {
240241
text-decoration: underline;
241242
}
242243

244+
.token.strike .token.content {
245+
text-decoration: line-through;
246+
}
247+
243248

244249
.token.brace.brace-active {
245250
position: relative;

full.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@ body.notransition .bottom-wrapper {
7676
}
7777

7878
.bottom-wrapper.hidden {
79+
pointer-events: none;
7980
transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)));
8081
}
8182

8283
.bottom-wrapper.expanded {
84+
pointer-events: auto;
8385
transform: translateY(calc(-1 * var(--window-height, 100vh) + 44px + env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px)));
8486
height: 44px;
8587
}
@@ -1665,10 +1667,14 @@ body:not(.mobile) .menu::-webkit-scrollbar-thumb {
16651667
background-color: rgb(130 134 137 / 50%);
16661668
}
16671669

1668-
body:not(.mobile) .menu::-webkit-scrollbar-thumb:not(:active):hover {
1670+
body:not(.mobile) .menu::-webkit-scrollbar-thumb:hover {
16691671
background-color: rgb(130 134 137 / 65%);
16701672
}
16711673

1674+
body:not(.mobile) .menu::-webkit-scrollbar-thumb:active {
1675+
background-color: rgb(130 134 137 / 50%);
1676+
}
1677+
16721678
.menu .icon {
16731679
padding: 10px 15px;
16741680
padding: 8px 13px;

lib/plugins/codeit-autolinker.js

Lines changed: 54 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
return;
55
}
66

7-
var url = /\b([a-z]{3,7}:\/\/|tel:)[\w\-+%~/.:=&@]+(?:\?[\w\-+%~/.:=?&!$'()*,;@]*)?(?:#[\w\-+%~/.:#=?&!$'()*,;@]*)?/;
7+
var url = /\b([a-z]{3,7}:\/\/|tel:)[\w\-+%~/.:=&!$'()*,;@]+(?:\?[\w\-+%~/.:=?&!$'()*,;@]*)?(?:#[\w\-+%~/.:#=?&!$'()*,;@]*)?/;
88
var email = /\b\S+@[\w.]+[a-z]{2}/;
99
var linkMd = /\[([^\]]+)\]\(([^)]+)\)/;
1010

@@ -13,7 +13,7 @@
1313

1414
Prism.plugins.autolinker = {
1515
processGrammar: function (grammar) {
16-
// Abort if grammar has already been processed
16+
// abort if grammar has already been processed
1717
if (!grammar || grammar['url-link']) {
1818
return;
1919
}
@@ -26,7 +26,7 @@
2626
}
2727

2828
def.inside = def.inside || {};
29-
29+
3030
if (type == 'comment') {
3131
def.inside['md-link'] = linkMd;
3232
}
@@ -45,40 +45,60 @@
4545
};
4646

4747
Prism.hooks.add('before-tokenize', function (env) {
48-
if (env.language !== 'markdown') {
49-
Prism.plugins.autolinker.processGrammar(env.grammar);
50-
}
48+
if (env.language === 'markdown') return;
49+
Prism.plugins.autolinker.processGrammar(env.grammar);
5150
});
51+
52+
53+
const onClickEvent = 'if ((event.ctrlKey || event.metaKey) && event.shiftKey) { event.preventDefault(); window.open(this.href, \'_blank\') }';
54+
55+
const isMac = navigator.platform.indexOf('Mac') > -1;
56+
57+
const linkTitle = isMac ? '⌘ + ⇧ + click to open link' : 'Ctrl + Shift + click to open link';
58+
59+
Prism.hooks.add('wrap', function (env) {
60+
61+
if (env.language === 'markdown') return;
62+
63+
if (env.language === 'markdown' &&
64+
env.type === 'url-reference') {
65+
66+
let matches = env.content.match(url);
67+
68+
if (matches && matches[0]) {
69+
70+
matches[0] = matches[0].replaceAll('\'','').replaceAll('"','').replaceAll('`','');
71+
72+
env.content = env.content.replace(matches[0], '<a class="token url-link" title="' + linkTitle + '" onclick="' + onClickEvent + '" href="'+ matches[0] + '">' + matches[0] + '</a>');
73+
74+
}
75+
76+
}
77+
78+
if (/-link$/.test(env.type)) {
79+
env.tag = 'a';
80+
81+
var href = env.content;
82+
83+
if (env.type == 'email-link' && href.indexOf('mailto:') != 0) {
84+
href = 'mailto:' + href;
85+
} else if (env.type == 'md-link') {
86+
// markdown
87+
var match = env.content.match(linkMd);
88+
89+
href = match[2];
90+
env.content = match[1];
91+
}
92+
93+
env.attributes.href = href.replaceAll('\'','').replaceAll('"','').replaceAll('`','');
5294

53-
Prism.hooks.add('wrap', function (env) {
54-
if (env.language !== 'markdown') {
55-
if (/-link$/.test(env.type)) {
56-
env.tag = 'a';
57-
58-
var href = env.content;
59-
60-
if (env.type == 'email-link' && href.indexOf('mailto:') != 0) {
61-
href = 'mailto:' + href;
62-
} else if (env.type == 'md-link') {
63-
// Markdown
64-
var match = env.content.match(linkMd);
65-
66-
href = match[2];
67-
env.content = match[1];
68-
}
69-
70-
var isMac = navigator.platform.indexOf('Mac') > -1;
71-
72-
env.attributes.href = href.replaceAll('\'','').replaceAll('"','').replaceAll('`','');
73-
74-
env.attributes.onclick = 'if ((event.ctrlKey || event.metaKey) && event.shiftKey) { event.preventDefault(); window.open(this.href, "_blank") }';
75-
env.attributes.title = isMac ? '⌘ + ⇧ + click to open link' : 'Ctrl + Shift + click to open link';
95+
env.attributes.onclick = onClickEvent;
96+
env.attributes.title = linkTitle;
7697

77-
// silently catch any error thrown by decodeURIComponent
78-
try {
79-
env.content = decodeURIComponent(env.content);
80-
} catch (e) {}
81-
}
98+
// silently catch any error thrown by decodeURIComponent
99+
try {
100+
env.content = decodeURIComponent(env.content);
101+
} catch (e) {}
82102
}
83103
});
84104

lib/plugins/codeit-match-braces.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
}
156156

157157
Prism.hooks.add('complete', function (env) {
158-
158+
159159
var code = env.element;
160160

161161
rematch(code);

live-view/extensions/markdown-dark.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,10 @@ body table {
207207
-webkit-appearance: none;
208208
}
209209

210-
body table::-webkit-scrollbar-track {
210+
body:not(.mobile) table::-webkit-scrollbar-track {
211211
border-radius: 0 0 10px 10px;
212212
background-color: var(--color-canvas-default) !important;
213-
box-shadow: inset 0px 1px 0 0 var(--color-border-default) !important;
213+
box-shadow: inset 0 1px 0 0 var(--table-border-color);
214214
}
215215

216216
body thead {
@@ -286,7 +286,7 @@ body cd-el {
286286
cursor: unset;
287287
}
288288

289-
body cd-el::-webkit-scrollbar-track {
289+
body:not(.mobile) cd-el::-webkit-scrollbar-track {
290290
border-radius: 0 0 10px 10px;
291291
}
292292

worker/client-channel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
// update worker name when updating worker
7-
const WORKER_NAME = 'codeit-worker-v625';
7+
const WORKER_NAME = 'codeit-worker-v627';
88

99

1010
// internal paths

0 commit comments

Comments
 (0)