土法列表表格-这回原理我也说不清了

啊 反正就是改了一下列表的css

效果差不多这样

土法列表表格-这回原理我也说不清了 - 图1

原代码(已失效, 建议查看修复后代码)

📎liebiaobiaoge.css

  1. .protyle-wysiwyg *[custom-liebiaobiaoge="1"] .protyle-action{
  2. display: table-cell;
  3. }
  4. .protyle-wysiwyg *[custom-liebiaobiaoge="1"]
  5. .protyle-wysiwyg *[custom-liebiaobiaoge="1"] .list ,
  6. .protyle-wysiwyg *[custom-liebiaobiaoge="1"] .li .list{
  7. border-style: solid;
  8. border-width: 0px;
  9. padding-left: 0px !important;
  10. padding-right: 0px !important;
  11. padding-top: 0px !important;
  12. padding-bottom: 0px !important;
  13. margin: 0px !important;
  14. width: 100%;
  15. height: inherit !important;
  16. display: table-column-group;
  17. outline: solid rgba(0, 0, 0, 1) 1px;
  18. overflow-block: hidden;
  19. }
  20. .protyle-wysiwyg *[custom-liebiaobiaoge="1"] .li{
  21. font-size: large !important;
  22. border-style: solid;
  23. border-width: 0px;
  24. padding-left: 0px !important;
  25. padding-right: 0px !important;
  26. padding-top: 0px !important;
  27. padding-bottom: 0px !important;
  28. margin: 0px !important;
  29. width: 100% !important;
  30. min-height: 36px;
  31. display: -webkit-flex;
  32. outline: solid rgba(0, 0, 0, 1) 1px;
  33. overflow-x: auto;
  34. }
  35. .protyle-wysiwyg *[custom-liebiaobiaoge="1"] .p {
  36. width: min-content;
  37. min-width: 200px;
  38. margin-right: 0px;
  39. margin-left: 0px;
  40. display: table-cell;
  41. }
  42. .protyle-wysiwyg *[custom-liebiaobiaoge="1"] .div {
  43. width: min-content;
  44. min-width: 20px !important;
  45. }
  46. .protyle-wysiwyg *[custom-liebiaobiaoge="1"] .li::first-line .p{
  47. width: 100% !important;
  48. }
  49. .protyle-wysiwyg *[custom-liebiaobiaoge="1"] .list:last-child:first-child ~ li .p{
  50. width: 100% !important;
  51. }
  52. .protyle-wysiwyg *[custom-liebiaobiaoge="1"] .protyle.attr:last-child:nth-child(3) .p{
  53. width: 100% !important;
  54. }

陈年老物了,我现在也不记得哪些是多余的代码,有兴趣的可以自己修改好加到主题里,custom-liebiaobiaoge=”1”这里是使用了自定义属性筛选,你可以换成自己喜欢的.

修复后代码

感谢 思源笔记二群 (155585856)ZYF 同学的贡献
为一个列表块(无序列表/有序列表/任务列表均可)设置块自定义属性 type: table即可使用

  1. /* --------------------------------------用自定义属性,列表转化为表格------------------------------------------- */
  2. .protyle-wysiwyg *[custom-type="table"] .protyle-action {
  3. display: table-cell;
  4. }
  5. .protyle-wysiwyg div.list[custom-type="table"] div.list,
  6. .protyle-wysiwyg div.list[custom-type="table"] div.li {
  7. border: 0;
  8. padding: 0;
  9. margin: 0;
  10. height: 100%;
  11. outline: 1px solid var(--b3-theme-on-surface);
  12. }
  13. /* 顶层列表块 */
  14. /* .protyle-wysiwyg div.list[custom-type="table"] {} */
  15. /* 嵌套列表块 */
  16. .protyle-wysiwyg div.list[custom-type="table"] div.list {
  17. width: 100%;
  18. }
  19. /* 列表项 */
  20. .protyle-wysiwyg div.list[custom-type="table"] div.li {
  21. width: auto;
  22. display: flex;
  23. overflow-x: auto;
  24. }
  25. /* 列表项内容 */
  26. .protyle-wysiwyg div.list[custom-type="table"] div[data-node-id]:not(.li, .list) {
  27. min-width: 128px;
  28. width: auto;
  29. text-align: justify;
  30. }
  31. /* 去除辅助线 */
  32. .protyle-wysiwyg div.list[custom-type="table"] div.li>div:before {
  33. display: none;
  34. }
  35. /* --------------------------------------用自定义属性,列表转化为表格 END------------------------------------------- */