todolist.css 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. :root {
  6. --ck-todo-list-checkmark-size: 16px;
  7. }
  8. /*
  9. * Inside editing view <label> elements are not wrapping description of an item.
  10. */
  11. .ck-editor__editable .todo-list {
  12. & .todo-list__label__description,
  13. & .todo-list__label {
  14. vertical-align: middle;
  15. display: inline-block;
  16. }
  17. }
  18. .ck-content .todo-list {
  19. list-style: none;
  20. & li {
  21. margin-bottom: 5px;
  22. & .todo-list {
  23. margin-top: 5px;
  24. }
  25. }
  26. & .todo-list__label {
  27. & > input {
  28. -webkit-appearance: none;
  29. display: inline-block;
  30. position: relative;
  31. width: var(--ck-todo-list-checkmark-size);
  32. height: var(--ck-todo-list-checkmark-size);
  33. vertical-align: middle;
  34. /* Needed on iOS */
  35. border: 0;
  36. /* LTR styles */
  37. left: -25px;
  38. margin-right: -15px;
  39. right: 0;
  40. margin-left: 0;
  41. &::before {
  42. display: block;
  43. position: absolute;
  44. box-sizing: border-box;
  45. content: '';
  46. width: 100%;
  47. height: 100%;
  48. border: 1px solid hsl(0, 0%, 20%);
  49. border-radius: 2px;
  50. transition: 250ms ease-in-out box-shadow, 250ms ease-in-out background, 250ms ease-in-out border;
  51. }
  52. &::after {
  53. display: block;
  54. position: absolute;
  55. box-sizing: content-box;
  56. pointer-events: none;
  57. content: '';
  58. /* Calculate tick position, size and border-width proportional to the checkmark size. */
  59. left: calc( var(--ck-todo-list-checkmark-size) / 3 );
  60. top: calc( var(--ck-todo-list-checkmark-size) / 5.3 );
  61. width: calc( var(--ck-todo-list-checkmark-size) / 5.3 );
  62. height: calc( var(--ck-todo-list-checkmark-size) / 2.6 );
  63. border-style: solid;
  64. border-color: transparent;
  65. border-width: 0 calc( var(--ck-todo-list-checkmark-size) / 8 ) calc( var(--ck-todo-list-checkmark-size) / 8 ) 0;
  66. transform: rotate(45deg);
  67. }
  68. &[checked] {
  69. &::before {
  70. background: hsl(126, 64%, 41%);
  71. border-color: hsl(126, 64%, 41%);
  72. }
  73. &::after {
  74. border-color: hsl(0, 0%, 100%);
  75. }
  76. }
  77. }
  78. & .todo-list__label__description {
  79. vertical-align: middle;
  80. }
  81. }
  82. }
  83. /* RTL styles */
  84. [dir="rtl"] .todo-list .todo-list__label > input {
  85. left: 0;
  86. margin-right: 0;
  87. right: -25px;
  88. margin-left: -15px;
  89. }
  90. /*
  91. * To-do list should be interactive only during the editing
  92. * (https://github.com/ckeditor/ckeditor5/issues/2090).
  93. */
  94. .ck-editor__editable .todo-list .todo-list__label > input {
  95. cursor: pointer;
  96. &:hover::before {
  97. box-shadow: 0 0 0 5px hsla(0, 0%, 0%, 0.1);
  98. }
  99. }