decentralized-blogging-platform/webapp/views/write/write.js
webapp/views/write/write.jsRaw
1'use strict';
2
3angular.module('app.write', ['ngRoute'])
4
5 .config(['$routeProvider', function($routeProvider) {
6 $routeProvider.when('/write', {
7 templateUrl: 'views/write/write.html',
8 controller: 'WriteCtrl'
9 });
10 }])
11
12 .controller('WriteCtrl', function($scope, $rootScope, $http) {
13 $scope.content = "";
14 var editor = new MediumEditor('.editable', {
15 toolbar: {
16 /* These are the default options for the toolbar,
17 if nothing is passed this is what is used */
18 allowMultiParagraphSelection: true,
19 buttons: ['bold', 'italic', 'underline', 'anchor', 'h2', 'h3', 'quote'],
20 diffLeft: 0,
21 diffTop: -10,
22 firstButtonClass: 'medium-editor-button-first',
23 lastButtonClass: 'medium-editor-button-last',
24 relativeContainer: null,
25 standardizeSelectionStart: false,
26 static: false,
27 /* options which only apply when static is true */
28 align: 'center',
29 sticky: false,
30 updateOnEmptySelection: false
31 },
32 autoLink: true,
33 placeholder: {
34 text: 'Start to writting your decentralized blog post...'
35 }
36 }).subscribe('editableInput', function (event, editable) {
37 // Do some work
38 $scope.content = editable.innerHTML;
39 console.log($scope.content);
40 });
41
42 });