Position the textAngular toolbar at the bottom of the text editing interface

I want to position the textAngular toolbar at the bottom of the texteditor-div instead of the top. Despite trying various CSS modifications, I haven't been successful in achieving this.

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

Answer №1

If you want to customize the toolbar for the text-angular directive, you can use the ta-target-toolbars attribute:

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

For a demonstration, check out this example: http://plnkr.co/edit/B2NU8RpUlSrKVFAlpOU2?p=preview

You can find the relevant code related to ta-target-toolbars in textAngular on this link: https://github.com/fraywing/textAngular/blob/64d31658186bb9bb54c07f7c719d73a472d60b11/src/textAngular.js#L642-L656

Answer №2

One way to adjust the layout is by using css to reposition the toolbar below the text area.

For detailed instructions, you can visit this link: http://plnkr.co/edit/Wu1mc0v5bbuoLkvvDb9V?p=preview

.ta-editor {
  height: 400px;
  overflow: auto;
  font-family: inherit;
  font-size: 100%;
  margin: 20px 0;
  position: absolute;
  top: 0;
  width: 100%;
}
.editor-wrapper {
  position: relative;
  height: 470px;
}
.ta-toolbar {
  position: absolute;
  bottom: 0;
  width: 100%;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Combining arrays that run parallel in Jquery

Seeking a solution similar to looping through multiple arrays in parallel using jQuery, but this time to construct an HTML page. I have three sets of parallel objects with arrays, potentially forming a 2D array. {"images":["Bellevue\/images\/1. ...

inject spinner during the call and verify status post-call

How can I make the loading icon display during the save function call and then switch to the check mark icon after the function resolves instead of mocking it on a timeout? function save() { successMessage() new Promise((resolve, reject) => { setTim ...

Is there a way to change the text (price) when I select an option?

<div class="single-pro-details"> <!--Customize in the CSS--> <h6>Home / Beats</h6> <h4>Unique Lil Tecca Type Beat - New Love</h4> <h2 id="price">$ ...

Is it better to use multiple containers or just one parent container in Bootstrap?

For instance, consider this: <div class="container"> <!-- First child element --> <!-- Second child element --> </div> or: <div class="container"> <!-- First child element --> </div> ...

Apply a box-shadow to the lower part of the div starting from the center

After much searching, I finally found a preview of what I had in mind. Unfortunately, I couldn't find the right words to describe it. Here is the link to the image for reference: https://i.sstatic.net/t2q27.png Thank you in advance for your help. ...

Issue with localstorage in app startup

Below is the code snippet I am working with angular .module('core') .factory('jsonstorage',function($rootScope,$http,$localStorage){ return { set: function(entity, value) { $rootScope.$storage = $localStorage; ...

Iterate through a generic array to populate a table using ng-repeat

In the scenario I'm currently facing, I am working on creating a common reusable table structure using a directive. The goal is to display different JSON data in both the table header and body. Below is the controller code: angular.module('plun ...

position property in div element disrupts slider functionality

I've been working on incorporating a simple slider into my website and stumbled upon this example on jsfiddle My goal is to have the slider positioned "relative" within my site, but when I change the CSS to position: relative;, the slider no longer ...

Utilizing ngblur and ngfocus to toggle visibility of dropdown options in Angular

Whenever I click off the list without selecting anything, the ngblur event isn't triggered when using select and option. I'm searching for a directive that can help me determine when the options in the select are shown or hidden. Any suggestions ...

Is there a way to undo the transition when hovering out?

Is it possible to achieve a reverse transition animation on hover out using CSS? I want the "Menu" text to slide to the right blue line when I hover out, and after a delay of 400ms, slide back from the left grey line. Can this be done? .menu { displ ...

Can the individual headers of an ag-grid column be accessed in order to apply an on-mouseover event with a specific method?

In my current project, I am utilizing ag-grid to create a dynamic web-application that combines tools from various Excel files into one cohesive platform. One of the Excel features I am currently working on involves displaying a description when hovering ...

Using Accordions in Jquery to dynamically adjust page height during ajax calls

I am currently using AJAX to call in a page and animate its height successfully. However, I have encountered an issue with an accordion-like function that is supposed to toggle the visibility of an element and adjust the height of the containing element ac ...

What could be causing the CSS border to not show up on the webpage?

I am trying to add a border to the footer, but it seems like something is blocking it from showing properly. Below are the CSS lines I have used: position: fixed; bottom: 0; right: 0; left: 0; clear: both; line-height: 1.36em; padding: 08px 0px 0px; tex ...

The alignment of the label on the Watu Quiz does not match with the Radio Button

I've encountered an issue with a Watu quiz I created where the labels are not aligning with the radio buttons. Any suggestions on how to style this and fix the alignment? You can view the page here. Here is a screenshot for reference: https://i.sst ...

Update the button color to transform it from a dull grey when disabled to a vibrant shade

I am trying to modify the button color in my script from grey to green when it transitions from disabled to enabled status. Despite using both the disabled and enabled properties in my CSS and incorporating vue.js (which I am not very familiar with), the c ...

What causes the discrepancy between a scope's number of watchers and its watchers count in AngularJS?

Can you explain the distinction between a scope's $$watchers field and $$watchersCount? And why do they sometimes have different values? If you visit angularjs.org, open Chrome developer tools, and run angular.element('body').scope(), you m ...

Separating the rules for development and production modes in the webpack configuration file

I'm currently in the process of working on a front-end project using HTML. Within my project, I have integrated the Webpack module bundler and am utilizing the image-webpack-loader package for image optimization. However, I've encountered an issu ...

Tips for retaining and showing previously inputted information in form fields

I have 2 forms on each page. Here is an example of one of them. $('form').submit(function(e) { e.preventDefault(); }) <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <form action="" me ...

Customize the Kendo UI appearance using JavaScript

Currently, I am trying to modify the background color of certain controls using JavaScript. While I have figured out how to do this for DropDownList and ComboBox components, I'm facing difficulty with the DatePicker. The frustrating part is that there ...

Tips for retaining form inputs without the need for a submit event when the page is reloaded or refreshed

I have a form on a page with multiple text inputs In addition to the form, I have implemented Zend pagination to allow users to select results. However, when using Zend paginate, the user's form inputs are lost because it is not submitted. Since th ...