Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Place textAngular toolbar at bottom of the textEditor

I'm trying to add the textAngular toolbar at bottom of the texteditor-div. Right now it renders at the top. I've been trying playin around with the css alot but with no sucess.

JS:

var app = angular.module('myApp', ['textAngular']);
app.controller('AppCtrl', function($scope, $http) {
$scope.htmlcontent  = "<h2>New Note...</h2>";

$scope.save =function() {

console.log( $scope.htmlcontent );

 $http.post("/Home/SaveWNote", { jsonData: $scope.htmlcontent });

}
});

HTML:

<!doctype html>
<head>
<meta charset="utf-8">
<title>Testing</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/rangy/1.2.3/rangy-core.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/textAngular/1.2.0/textAngular-sanitize.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/textAngular/1.2.0/textAngular.min.js'></script>

<script src="script.js"></script>
<link rel="stylesheet" href="style.css"/>
</head>
<body ng-app="myApp">

<div ng-controller="AppCtrl">
  <div text-angular ng-model="htmlcontent "></div>

  <button ng-click="save()">Save</button>
  <br/>

Your htmlcontent <pre>{{htmlcontent}}</pre>
</div>
</body>
</html>

PREVIEW: http://plnkr.co/edit/Wu1mc0v5bbuoLkvvDb9V?p=preview

like image 232
user3228992 Avatar asked Jan 10 '23 01:01

user3228992


1 Answers

You can use the attribute ta-target-toolbars on the text-angular directive to have it register with an alternate toolbar:

<div text-angular ta-target-toolbars="toolbar" ng-model="htmlcontent"></div>
<div text-angular-toolbar class="toolbar" name="toolbar"></div>

Here is an example: http://plnkr.co/edit/B2NU8RpUlSrKVFAlpOU2?p=preview

The relevant lines of code involcing ta-target-toolbars from textAngular are available here: https://github.com/fraywing/textAngular/blob/64d31658186bb9bb54c07f7c719d73a472d60b11/src/textAngular.js#L642-L656

like image 62
potatosalad Avatar answered Jan 18 '23 13:01

potatosalad