How to use the @kui-shell/plugin-editor/web/css/editor.css.toString function in @kui-shell/plugin-editor

To help you get started, we’ve selected a few @kui-shell/plugin-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IBM / kui / plugins / plugin-editor / src / lib / open.ts View on Github external
const getEntityFn = (custom && custom.getEntity) || currentSelection
  let currentEntity = getEntityFn(tab)
  const getEntity = () => currentEntity

  // for certain content types, always show folding controls, rather
  // than on mouse over (which is the default behavior for monaco)
  const entityRightNow = currentEntity
  const kind = entityRightNow && ((entityRightNow.exec && entityRightNow.exec.kind) || entityRightNow.contentType)
  if (kind === 'yaml' || kind === 'json') {
    options.showFoldingControls = 'always'
  }

  if (!pre2) {
    injectCSS({
      css: require('@kui-shell/plugin-editor/web/css/editor.css').toString(),
      key: 'editor.editor'
    })
    pre2 = true
  }

  const content = document.createElement('div')
  const editorWrapper = document.createElement('div')

  editorWrapper.className = 'monaco-editor-wrapper'
  content.appendChild(editorWrapper)

  // we want the editor to have focus, so the user can start coding
  // (but don't bother if we are in readOnly mode)
  if (!options.readOnly) {
    editorWrapper.focus()
  }