summaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2020-12-13 02:05:50 +0100
committerGitHub <noreply@github.com>2020-12-13 09:05:50 +0800
commit41e8b834afbd0c98a8ab4549a90a6bce0ec7096f (patch)
tree67e3a2de682b8884af5befeaa47b1924aa83fbd3 /web_src
parent287b594803105ba517680aa50be478648d434035 (diff)
downloadgitea-41e8b834afbd0c98a8ab4549a90a6bce0ec7096f.tar.gz
gitea-41e8b834afbd0c98a8ab4549a90a6bce0ec7096f.zip
Markdown task list improvements (#13952)
* Markdown task list improvements - Remove `.ui` class and wrappers to prevent fomantic from messing with it. - Change rendered HTML to match GitHub. - Add custom styling for the checkboxes. * fix unittest Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'web_src')
-rw-r--r--web_src/less/_markdown.less56
1 files changed, 50 insertions, 6 deletions
diff --git a/web_src/less/_markdown.less b/web_src/less/_markdown.less
index 4c8ed77cb8..f931106d95 100644
--- a/web_src/less/_markdown.less
+++ b/web_src/less/_markdown.less
@@ -162,9 +162,57 @@
list-style-type: none;
}
- li.task-list-item {
+ .task-list-item {
list-style-type: none;
- margin-left: calc(-2em + 2px);
+
+ input[type="checkbox"] {
+ margin: 0 6px .25em -1.6em;
+ }
+ }
+
+ .task-list-item + .task-list-item {
+ margin-top: 3px;
+ }
+
+ input[type="checkbox"] {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ position: relative;
+ border: 1px solid var(--color-secondary);
+ border-radius: 2px;
+ background: var(--color-input-background);
+ height: 14px;
+ width: 14px;
+ opacity: 1 !important; // override fomantic on edit preview
+ pointer-events: auto !important; // override fomantic on edit preview
+ vertical-align: middle !important; // override fomantic on edit preview
+ }
+
+ input[type="checkbox"]:not([disabled]):hover,
+ input[type="checkbox"]:not([disabled]):active {
+ border-color: var(--color-primary);
+ }
+
+ input[type="checkbox"]::after {
+ position: absolute;
+ left: 0;
+ top: 0;
+ bottom: 0;
+ right: 0;
+ pointer-events: none;
+ background: var(--color-text);
+ mask-size: cover;
+ }
+
+ input[type="checkbox"]:checked::after {
+ content: "";
+ mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="-1 -1 18 18" width="16" height="16"><path fill-rule="evenodd" d="M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"></path></svg>');
+ }
+
+ input[type="checkbox"]:indeterminate::after {
+ content: "";
+ mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M2 7.75A.75.75 0 012.75 7h10a.75.75 0 010 1.5h-10A.75.75 0 012 7.75z"></path></svg>');
}
ul ul,
@@ -422,10 +470,6 @@
box-shadow: inset 0 -1px 0 var(--color-secondary);
}
- input[type="checkbox"] {
- vertical-align: middle !important;
- }
-
.csv-data td,
.csv-data th {
padding: 5px;