Просмотр исходного кода

Extract rich text code to module

Alasdair Smith 8 лет назад
Родитель
Сommit
3f8eda2223

+ 0 - 2
services/web/public/coffee/ide/editor/EditorManager.coffee

@@ -1,9 +1,7 @@
 define [
 define [
 	"ide/editor/Document"
 	"ide/editor/Document"
 	"ide/editor/directives/aceEditor"
 	"ide/editor/directives/aceEditor"
-	"ide/editor/directives/cmEditor"
 	"ide/editor/controllers/SavingNotificationController"
 	"ide/editor/controllers/SavingNotificationController"
-	"ide/editor/controllers/EditorToolbarController"
 ], (Document) ->
 ], (Document) ->
 	class EditorManager
 	class EditorManager
 		constructor: (@ide, @$scope) ->
 		constructor: (@ide, @$scope) ->

+ 0 - 7
services/web/public/coffee/ide/editor/controllers/EditorToolbarController.coffee

@@ -1,7 +0,0 @@
-define [
-	"base"
-	"ide/editor/Document"
-], (App, Document) ->
-  App.controller "EditorToolbarController", ($scope, ide) ->
-    $scope.toggleRichText = () ->
-      ide.editorManager.toggleRichText()

+ 0 - 33
services/web/public/coffee/ide/editor/directives/cmEditor.coffee

@@ -1,33 +0,0 @@
-define [
-  "base"
-], (App) ->
-  App.directive "cmEditor", () ->
-    return {
-      scope: {
-        sharejsDoc: "="
-      }
-
-      link: (scope, element, attrs) ->
-        cm = Frontend.richText.init(element.find('.cm-editor-wrapper')[0])
-
-        scope.$watch "sharejsDoc", (sharejsDoc, oldSharejsDoc) ->
-          if oldSharejsDoc?
-            detachFromCM(oldSharejsDoc)
-          if sharejsDoc?
-            attachToCM(sharejsDoc)
-
-        attachToCM = (sharejsDoc) ->
-          scope.$applyAsync () ->
-            Frontend.richText.openDoc(cm, sharejsDoc.getSnapshot())
-            sharejsDoc.attachToCM(cm)
-
-        detachFromCM = (sharejsDoc) ->
-          sharejsDoc.detachFromCM()
-
-        scope.$on 'destroy', () ->
-          detachFromCM(scope.sharejsDoc)
-
-      template: """
-        <div class="cm-editor-wrapper"></div>
-      """
-    }

+ 0 - 16
services/web/public/es/rich-text.js

@@ -1,16 +0,0 @@
-import CodeMirror, { Doc } from 'codemirror'
-
-export function init (rootEl) {
-  CodeMirror.defineMIME('application/x-tex', 'latex')
-  CodeMirror.defineMIME('application/x-latex', 'latex')
-
-  return CodeMirror(rootEl, {
-    mode: 'latex'
-  })
-}
-
-export function openDoc (cm, content) {
-  const newDoc = Doc(content, 'latex')
-  cm.swapDoc(newDoc)
-  return newDoc
-}