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

Hide rich text behind feature flag

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

+ 2 - 0
services/web/app/coffee/infrastructure/Features.coffee

@@ -14,5 +14,7 @@ module.exports = Features =
 				return Settings.enableGithubSync
 			when 'v1-return-message'
 				return Settings.accountMerge? and Settings.overleaf?
+			when 'rich-text'
+				return Settings.showRichText
 			else
 				throw new Error("unknown feature: #{feature}")

+ 5 - 4
services/web/app/views/project/editor.pug

@@ -159,10 +159,11 @@ block requirejs
 		window.uiConfig = JSON.parse('!{JSON.stringify(uiConfig).replace(/\//g, "\\/")}');
 
 	// TODO: inject based on environment
-	script(
-		src="http://localhost:3809/public/js/es/richText.js"
-		type="text/javascript"
-	)
+	if hasFeature('rich-text')
+		script(
+			src="http://localhost:3809/public/js/es/richText.js"
+			type="text/javascript"
+		)
 
 	script(
 		data-main=buildJsPath("ide.js", {hashedPath:false}),

+ 9 - 7
services/web/app/views/project/editor/editor.pug

@@ -30,8 +30,9 @@ div.full-size(
 				i.fa.fa-arrow-left
 				|   #{translate("open_a_file_on_the_left")}
 
-		.toolbar.toolbar-editor(ng-controller="EditorToolbarController")
-			button(ng-click="toggleRichText()") Rich Text
+		if hasFeature('rich-text')
+			.toolbar.toolbar-editor(ng-controller="EditorToolbarController")
+				button(ng-click="toggleRichText()") Rich Text
 
 		#editor(
 			ace-editor="editor",
@@ -66,11 +67,12 @@ div.full-size(
 			renderer-data="reviewPanel.rendererData"
 		)
 
-		#editor-rich-text(
-			cm-editor
-			ng-if="!editor.opening && editor.richText"
-			sharejs-doc="editor.sharejs_doc"
-		)
+		if hasFeature('rich-text')
+			#editor-rich-text(
+				cm-editor
+				ng-if="!editor.opening && editor.richText"
+				sharejs-doc="editor.sharejs_doc"
+			)
 
 		include ./review-panel
 

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

@@ -192,4 +192,3 @@ define [
 
 		toggleRichText: () ->
 			@$scope.editor.richText = !@$scope.editor.richText
-