overleaf/services/web/frontend/js/ide/toolbar/EditorLoaderController.js

18 lines
452 B
JavaScript
Raw Normal View History

import App from '../../base'
App.controller('EditorLoaderController', function ($scope, localStorage) {
$scope.$watch('editor.showVisual', function (val) {
localStorage(
`editor.mode.${$scope.project_id}`,
val === true ? 'rich-text' : 'source'
)
})
$scope.$watch('editor.newSourceEditor', function (val) {
localStorage(
`editor.source_editor.${$scope.project_id}`,
val === true ? 'cm6' : 'ace'
)
})
})