UNPKG

@uiw/react-md-editor

Version:

A markdown editor with preview, implemented with React.js and TypeScript.

306 lines (305 loc) 6.75 kB
.w-md-editor-bar { position: absolute; cursor: s-resize; right: 0; margin-top: -11px; margin-right: 0; width: 14px; z-index: 3; height: 10px; border-radius: 0 0 3px 0; -webkit-user-select: none; user-select: none; } .w-md-editor-bar svg { display: block; margin: 0 auto; } .w-md-editor-aree { overflow: auto; border-radius: 5px; } .w-md-editor-text { min-height: 100%; position: relative; text-align: left; white-space: pre-wrap; word-break: keep-all; overflow-wrap: break-word; box-sizing: border-box; padding: 10px; margin: 0; font-size: 14px; line-height: 18px; -webkit-font-variant-ligatures: common-ligatures; font-variant-ligatures: common-ligatures; } .w-md-editor-text-pre, .w-md-editor-text-input, .w-md-editor-text > .w-md-editor-text-pre { margin: 0; border: 0; background: none; box-sizing: inherit; display: inherit; font-family: inherit; font-size: inherit; font-style: inherit; -webkit-font-variant-ligatures: inherit; font-variant-ligatures: inherit; font-weight: inherit; letter-spacing: inherit; line-height: inherit; -moz-tab-size: inherit; tab-size: inherit; text-indent: inherit; text-rendering: inherit; text-transform: inherit; white-space: inherit; overflow-wrap: inherit; word-break: inherit; word-break: normal; padding: 0; } .w-md-editor-text-pre > code, .w-md-editor-text-input > code, .w-md-editor-text > .w-md-editor-text-pre > code { font-family: inherit; } .w-md-editor-text-pre { position: relative; margin: 0px; pointer-events: none; } .w-md-editor-text-input { position: absolute; top: 0px; left: 0px; height: 100%; width: 100%; resize: none; color: inherit; overflow: hidden; outline: 0; padding: inherit; -webkit-font-smoothing: antialiased; -webkit-text-fill-color: transparent; } .w-md-editor-text-input:empty { -webkit-text-fill-color: inherit !important; } .w-md-editor-text-pre, .w-md-editor-text-input { word-wrap: pre; word-break: break-word; white-space: pre-wrap; } /** * Hack to apply on some CSS on IE10 and IE11 */ @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { /** * IE doesn't support '-webkit-text-fill-color' * So we use 'color: transparent' to make the text transparent on IE * Unlike other browsers, it doesn't affect caret color in IE */ .w-md-editor-text-input { color: transparent !important; } .w-md-editor-text-input::selection { background-color: #accef7 !important; color: transparent !important; } } .w-md-editor-text-pre { color: #333; } .w-md-editor-text-pre .table .punctuation { color: #c3c3c3; } .w-md-editor-text-pre .table .table-header { color: #000; } .w-md-editor-text-pre .url { color: #032f62 !important; } .w-md-editor-text-pre .url .content { color: #0366d6; } .w-md-editor-text-pre .hr { color: #999; } .w-md-editor-text-pre .blockquote { color: #a6a6a6; } .w-md-editor-text-pre .title, .w-md-editor-text-pre .bold { color: #000 !important; } .w-md-editor-text-pre .title { line-height: unset !important; font-size: unset !important; font-weight: unset !important; } .w-md-editor-text-pre .code.keyword { color: #596394 !important; } .w-md-editor-text-pre .strike { color: #bf4ca0; } .w-md-editor-toolbar-child { position: absolute; border-radius: 3px; box-shadow: 0 0 0 1px rgba(16, 22, 26, 0.1), 0 0 0 rgba(16, 22, 26, 0), 0 1px 1px rgba(16, 22, 26, 0.2); background-color: #fff; z-index: 1; display: none; } .w-md-editor-toolbar-child.active { display: block; } .w-md-editor-toolbar-child .w-md-editor-toolbar { border-bottom: 0; padding: 3px; border-radius: 3px; } .w-md-editor-toolbar-child .w-md-editor-toolbar ul > li { display: block; } .w-md-editor-toolbar-child .w-md-editor-toolbar ul > li button { width: -webkit-fill-available; height: initial; box-sizing: border-box; padding: 3px 4px 2px 4px; margin: 0; } .w-md-editor-toolbar { border-bottom: 1px solid #dfdfe0; background-color: #fbfbfb; padding: 0 5px 0 5px; display: flex; justify-content: space-between; align-items: center; border-radius: 3px 3px 0 0; -webkit-user-select: none; user-select: none; } .w-md-editor-toolbar ul, .w-md-editor-toolbar li { margin: 0; padding: 0; list-style: none; } .w-md-editor-toolbar li { display: inline-block; font-size: 14px; } .w-md-editor-toolbar li > button { border: none; height: 20px; line-height: 14px; background: none; color: #586069; padding: 4px; margin: 0 1px; border-radius: 2px; text-transform: none; font-weight: normal; overflow: visible; outline: none; cursor: pointer; transition: all 0.3s; white-space: nowrap; } .w-md-editor-toolbar li > button:hover, .w-md-editor-toolbar li > button:focus { color: #06c; background-color: #dcdcdc; } .w-md-editor-toolbar li > button:active { color: #6a57ff; background-color: #dcdcdc; } .w-md-editor-toolbar li > button:disabled { color: #ccc; cursor: not-allowed; } .w-md-editor-toolbar li > button:disabled:hover { background-color: transparent; color: #ccc; } .w-md-editor-toolbar li.active > button { color: #06c; background-color: #e8e8e8; } .w-md-editor-toolbar-divider { height: 14px; width: 1px; margin: -3px 3px 0 3px !important; vertical-align: middle; background-color: #ccc; } .w-md-editor { color: #24292e; text-align: left; box-shadow: 0 0 0 1px rgba(16, 22, 26, 0.1), 0 0 0 rgba(16, 22, 26, 0), 0 1px 1px rgba(16, 22, 26, 0.2); border-radius: 3px; padding-bottom: 1px; position: relative; background-color: #fff; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; } .w-md-editor-content { position: relative; border-radius: 0 0 3px 0; height: calc(100% - 39.1px); } .w-md-editor-input { width: 50%; height: 100%; } .w-md-editor-preview { width: 50%; box-sizing: border-box; box-shadow: inset 1px 0 0 0 #dfdfe0; position: absolute; padding: 10px 20px; overflow: auto; top: 0; right: 0; bottom: 0; } .w-md-editor-preview .anchor { display: none; } .w-md-editor-preview .contains-task-list { list-style: none; } .w-md-editor-show-preview .w-md-editor-input { width: 0%; overflow: hidden; background-color: #fdfdfd; } .w-md-editor-show-preview .w-md-editor-preview { width: 100%; box-shadow: inset 0 0 0 0; } .w-md-editor-show-edit .w-md-editor-input { width: 100%; } .w-md-editor-show-edit .w-md-editor-preview { width: 0%; padding: 0; } .w-md-editor-fullscreen { overflow: hidden; position: fixed; z-index: 9999; top: 0; left: 0; right: 0; bottom: 0; } .w-md-editor-fullscreen .w-md-editor-content { height: 100%; }