]> BookStack Code Mirror - bookstack/commitdiff
Merge branch 'fix-1575' of git://github.com/james-geiger/BookStack into james-geiger...
authorDan Brown <redacted>
Thu, 17 Oct 2019 13:32:39 +0000 (14:32 +0100)
committerDan Brown <redacted>
Thu, 17 Oct 2019 13:32:39 +0000 (14:32 +0100)
1  2 
resources/js/services/code.js
resources/sass/_text.scss

index ca66bdb5a8a43337e25f272a761bc10823885851,4ab25aeb7dcbef45f71c1c3e683c66df90daac11..61aac7dc5b4909e9c56a13069fe59287fee2a6d5
@@@ -102,6 -102,7 +102,7 @@@ function highlightElem(elem) 
          value: content,
          mode:  mode,
          lineNumbers: true,
+         lineWrapping: true,
          theme: getTheme(),
          readOnly: true
      });
@@@ -188,6 -189,7 +189,7 @@@ function wysiwygView(elem) 
          value: content,
          mode:  getMode(lang),
          lineNumbers: true,
+         lineWrapping: true,
          theme: getTheme(),
          readOnly: true
      });
@@@ -213,8 -215,8 +215,8 @@@ function popupEditor(elem, modeSuggesti
          value: content,
          mode:  getMode(modeSuggestion),
          lineNumbers: true,
-         theme: getTheme(),
-         lineWrapping: true
+         lineWrapping: true,
+         theme: getTheme()
      });
  }
  
@@@ -240,27 -242,24 +242,27 @@@ function setContent(cmInstance, codeCon
  }
  
  /**
 - * Get a CodeMirror instace to use for the markdown editor.
 + * Get a CodeMirror instance to use for the markdown editor.
   * @param {HTMLElement} elem
   * @returns {*}
   */
  function markdownEditor(elem) {
 -    let content = elem.textContent;
 -
 -    return CodeMirror(function (elt) {
 -        elem.parentNode.insertBefore(elt, elem);
 -        elem.style.display = 'none';
 -    }, {
 +    const content = elem.textContent;
 +    const config = {
          value: content,
          mode: "markdown",
          lineNumbers: true,
-         theme: getTheme(),
          lineWrapping: true,
+         theme: getTheme(),
          scrollPastEnd: true,
 -    });
 +    };
 +
 +    window.$events.emitPublic(elem, 'editor-markdown-cm::pre-init', {config});
 +
 +    return CodeMirror(function (elt) {
 +        elem.parentNode.insertBefore(elt, elem);
 +        elem.style.display = 'none';
 +    }, config);
  }
  
  /**
index 315f08c34b77261ce18ab6c1c7560441f8788dfb,5959ddab1d7096c2c5c292d0420e43d5c06185b9..cf78c162b95c72fc66e9643982bbc4c5aec90ec3
@@@ -90,14 -90,14 +90,14 @@@ h2.list-heading 
   * Link styling
   */
  a {
 -  color: $primary;
 +  color: var(--color-primary);
 +  fill: var(--color-primary);
    cursor: pointer;
    text-decoration: none;
 -  transition: color ease-in-out 80ms;
 +  transition: filter ease-in-out 80ms;
    line-height: 1.6;
    &:hover {
      text-decoration: underline;
 -    color: darken($primary, 20%);
    }
    &.icon {
      display: inline-block;
      position: relative;
      display: inline-block;
    }
 +  &:focus img:only-child {
 +    outline: 2px dashed var(--color-primary);
 +    outline-offset: 2px;
 +  }
  }
  
  .blended-links a {
@@@ -199,7 -195,7 +199,7 @@@ pre 
  blockquote {
    display: block;
    position: relative;
 -  border-left: 4px solid $primary;
 +  border-left: 4px solid var(--color-primary);
    background-color: #F8F8F8;
    padding: $-s $-m $-s $-xl;
    &:before {
@@@ -224,7 -220,7 +224,7 @@@ code 
    @extend .code-base;
    display: inline;
    padding: 1px 3px;
-   white-space:pre;
+   white-space:pre-wrap;
    line-height: 1.2em;
    margin-bottom: 1.2em;
  }
@@@ -243,6 -239,7 +243,6 @@@ pre code 
  }
  
  span.highlight {
 -  //background-color: rgba($primary, 0.2);
    font-weight: bold;
    padding: 2px 4px;
  }
@@@ -369,4 -366,3 +369,3 @@@ span.sep 
    margin-right: $-xs;
    pointer-events: none;
  }