remove markdown refs, cleanup
This commit is contained in:
@@ -86,7 +86,6 @@ module.exports = function(grunt) {
|
||||
'vendor/assets/bower_components/angular-ui-router/release/angular-ui-router.js',
|
||||
'vendor/assets/bower_components/lodash/dist/lodash.min.js',
|
||||
'vendor/assets/bower_components/restangular/dist/restangular.js',
|
||||
'vendor/assets/bower_components/marked/lib/marked.js',
|
||||
'vendor/assets/javascripts/crypto/*.js'
|
||||
],
|
||||
dest: 'vendor/assets/javascripts/lib.js',
|
||||
|
||||
@@ -29,6 +29,11 @@ angular.module('app.frontend')
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('keydown', handler);
|
||||
scope.$on('$destroy', function(){
|
||||
window.removeEventListener('keydown', handler);
|
||||
})
|
||||
|
||||
scope.$watch('ctrl.note', function(note, oldNote){
|
||||
if(note) {
|
||||
ctrl.setNote(note, oldNote);
|
||||
@@ -39,7 +44,7 @@ angular.module('app.frontend')
|
||||
}
|
||||
}
|
||||
})
|
||||
.controller('EditorCtrl', function ($sce, $timeout, authManager, markdownRenderer, $rootScope, extensionManager, syncManager, modelManager) {
|
||||
.controller('EditorCtrl', function ($sce, $timeout, authManager, $rootScope, extensionManager, syncManager, modelManager) {
|
||||
|
||||
window.addEventListener("message", function(){
|
||||
console.log("App received message:", event);
|
||||
@@ -56,7 +61,6 @@ angular.module('app.frontend')
|
||||
}.bind(this), false);
|
||||
|
||||
this.setNote = function(note, oldNote) {
|
||||
this.editorMode = 'edit';
|
||||
this.showExtensions = false;
|
||||
this.showMenu = false;
|
||||
this.loadTagsString();
|
||||
@@ -107,15 +111,12 @@ angular.module('app.frontend')
|
||||
return extensionManager.extensionsInContextOfItem(this.note).length > 0;
|
||||
}
|
||||
|
||||
this.onPreviewDoubleClick = function() {
|
||||
this.editorMode = 'edit';
|
||||
this.focusEditor(100);
|
||||
}
|
||||
|
||||
this.focusEditor = function(delay) {
|
||||
setTimeout(function(){
|
||||
var element = document.getElementById("note-text-editor");
|
||||
element.focus();
|
||||
if(element) {
|
||||
element.focus();
|
||||
}
|
||||
}, delay)
|
||||
}
|
||||
|
||||
@@ -129,10 +130,6 @@ angular.module('app.frontend')
|
||||
this.showMenu = false;
|
||||
}
|
||||
|
||||
this.renderedContent = function() {
|
||||
return markdownRenderer.renderHtml(markdownRenderer.renderedContentForText(this.note.safeText()));
|
||||
}
|
||||
|
||||
var statusTimeout;
|
||||
|
||||
this.saveNote = function($event) {
|
||||
@@ -192,7 +189,6 @@ angular.module('app.frontend')
|
||||
}
|
||||
|
||||
this.onContentFocus = function() {
|
||||
this.showSampler = false;
|
||||
$rootScope.$broadcast("editorFocused");
|
||||
}
|
||||
|
||||
@@ -203,12 +199,7 @@ angular.module('app.frontend')
|
||||
this.toggleFullScreen = function() {
|
||||
this.fullscreen = !this.fullscreen;
|
||||
if(this.fullscreen) {
|
||||
if(this.editorMode == 'edit') {
|
||||
// refocus
|
||||
this.focusEditor(0);
|
||||
}
|
||||
} else {
|
||||
|
||||
this.focusEditor(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,15 +207,6 @@ angular.module('app.frontend')
|
||||
this.showMenu = false;
|
||||
}
|
||||
|
||||
this.toggleMarkdown = function() {
|
||||
if(this.editorMode == 'preview') {
|
||||
this.editorMode = 'edit';
|
||||
this.focusEditor(0);
|
||||
} else {
|
||||
this.editorMode = 'preview';
|
||||
}
|
||||
}
|
||||
|
||||
this.deleteNote = function() {
|
||||
if(confirm("Are you sure you want to delete this note?")) {
|
||||
this.remove()(this.note);
|
||||
@@ -232,11 +214,6 @@ angular.module('app.frontend')
|
||||
}
|
||||
}
|
||||
|
||||
this.clickedEditNote = function() {
|
||||
this.editorMode = 'edit';
|
||||
this.focusEditor(100);
|
||||
}
|
||||
|
||||
/* Tags */
|
||||
|
||||
this.loadTagsString = function() {
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
angular.module('app.frontend')
|
||||
.service('markdownRenderer', function ($sce) {
|
||||
|
||||
marked.setOptions({
|
||||
breaks: true,
|
||||
sanitize: true
|
||||
});
|
||||
|
||||
this.renderedContentForText = function(text) {
|
||||
if(!text || text.length == 0) {
|
||||
return "";
|
||||
}
|
||||
return marked(text);
|
||||
}
|
||||
|
||||
this.renderHtml = function(html_code) {
|
||||
return $sce.trustAsHtml(html_code);
|
||||
};
|
||||
|
||||
|
||||
});
|
||||
@@ -13,19 +13,17 @@
|
||||
.section-title-bar {
|
||||
border-bottom: none !important;
|
||||
|
||||
&.fullscreen {
|
||||
opacity: 0.0;
|
||||
-webkit-transition: all 300ms ease-in-out;
|
||||
-moz-transition: all 300ms ease-in-out;
|
||||
-ms-transition: all 300ms ease-in-out;
|
||||
-o-transition: all 300ms ease-in-out;
|
||||
transition: all 300ms ease-in-out;
|
||||
|
||||
&:hover {
|
||||
opacity: 1.0;
|
||||
}
|
||||
|
||||
// z-index: -1;
|
||||
// &.fullscreen {
|
||||
// opacity: 0.0;
|
||||
// -webkit-transition: all 300ms ease-in-out;
|
||||
// -moz-transition: all 300ms ease-in-out;
|
||||
// -ms-transition: all 300ms ease-in-out;
|
||||
// -o-transition: all 300ms ease-in-out;
|
||||
// transition: all 300ms ease-in-out;
|
||||
//
|
||||
// &:hover {
|
||||
// opacity: 1.0;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +42,10 @@
|
||||
width: 100%;
|
||||
padding-right: 10px;
|
||||
|
||||
&.fullscreen {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
> .title {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
@@ -93,15 +95,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.fullscreen-ghost-bar {
|
||||
|
||||
position: absolute;
|
||||
width: 20%;
|
||||
height: 200px;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
|
||||
.editor-content {
|
||||
max-height: 100%;
|
||||
|
||||
@@ -119,19 +112,6 @@
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
.sampler-container {
|
||||
margin-top: 10px;
|
||||
padding: 15px;
|
||||
padding-top: 17px;
|
||||
font-size: 17px;
|
||||
// opacity: 0.5;
|
||||
}
|
||||
|
||||
.sampler {
|
||||
// opacity: 0.5;
|
||||
color: rgba(black, 0.3);
|
||||
}
|
||||
|
||||
.editable {
|
||||
font-family: monospace;
|
||||
max-height: 100%;
|
||||
@@ -147,44 +127,9 @@
|
||||
&.fullscreen {
|
||||
padding: 85px 10%;
|
||||
max-width: 1200px;
|
||||
display: inline-block;;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.preview {
|
||||
// font-family: monospace;
|
||||
max-height: 100%;
|
||||
height: 100%;
|
||||
line-height: 23px;
|
||||
overflow-y: scroll;
|
||||
padding: 0px 15px;
|
||||
text-align: left;
|
||||
|
||||
&.fullscreen {
|
||||
padding: 85px 10%;
|
||||
max-width: 1200px;
|
||||
display: inline-block;;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.markdown {
|
||||
margin-left: 15px;
|
||||
float: right;
|
||||
text-align: right;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
ol {
|
||||
list-style-type: decimal;
|
||||
list-style-position: inside;
|
||||
-webkit-margin-before: 1em;
|
||||
-webkit-margin-after: 1em;
|
||||
-webkit-margin-start: 0px;
|
||||
-webkit-margin-end: 0px;
|
||||
-webkit-padding-start: 0px;
|
||||
}
|
||||
|
||||
.nav-tabs {
|
||||
|
||||
@@ -42,7 +42,3 @@ $dark-gray: #2e2e2e;
|
||||
display: inline-block;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
.icon-markdown:before {
|
||||
content: "\e901";
|
||||
}
|
||||
|
||||
@@ -21,9 +21,6 @@
|
||||
%li{"ng-click" => "ctrl.selectedMenuItem(); ctrl.toggleFullScreen()"}
|
||||
.text Toggle Fullscreen
|
||||
.shortcut Cmd + O
|
||||
%li{"ng-click" => "ctrl.selectedMenuItem(); ctrl.toggleMarkdown()"}
|
||||
.text Toggle Markdown Preview
|
||||
.shortcut Cmd + M
|
||||
%li{"ng-click" => "ctrl.deleteNote()"}
|
||||
.text Delete
|
||||
|
||||
@@ -45,6 +42,5 @@
|
||||
|
||||
.editor-content{"ng-class" => "{'fullscreen' : ctrl.fullscreen }"}
|
||||
%iframe#editor-iframe{"ng-if" => "ctrl.customEditor", "ng-src" => "{{ctrl.customEditor.url | trusted}}", "frameBorder" => "0", "style" => "width: 100%; height: 100%; z-index: 1000; float: left;"}
|
||||
%textarea.editable#note-text-editor{"ng-if" => "!ctrl.customEditor", "ng-class" => "{'fullscreen' : ctrl.fullscreen }", "ng-show" => "ctrl.editorMode == 'edit'", "ng-model" => "ctrl.note.text",
|
||||
%textarea.editable#note-text-editor{"ng-if" => "!ctrl.customEditor", "ng-class" => "{'fullscreen' : ctrl.fullscreen }", "ng-model" => "ctrl.note.text",
|
||||
"ng-change" => "ctrl.contentChanged()", "ng-click" => "ctrl.clickedTextArea()", "ng-focus" => "ctrl.onContentFocus()"}
|
||||
.preview{"ng-class" => "{'fullscreen' : ctrl.fullscreen }", "ng-if" => "ctrl.editorMode == 'preview'", "ng-bind-html" => "ctrl.renderedContent()", "ng-dblclick" => "ctrl.onPreviewDoubleClick()"}
|
||||
|
||||
@@ -9,8 +9,7 @@
|
||||
"dependencies": {
|
||||
"angular": "1.6.1",
|
||||
"angular-ui-router": "^0.3.2",
|
||||
"restangular": "^1.6.1",
|
||||
"marked": "0.3.6"
|
||||
"restangular": "^1.6.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"angular": "1.6.1"
|
||||
|
||||
Reference in New Issue
Block a user