I'm currently developing a Chrome application specifically designed for editing plain text. To achieve this, I am utilizing the <textarea> element. However, the app will not expand to full screen

Currently, I am in the process of developing a Chrome app and have implemented CSS from a previous post. The main issue I am facing is with the textarea element that I am using. I am open to exploring alternative solutions to achieve the desired outcome. Specifically, I am looking to ensure that the size of the textarea remains consistent with the window size.

You can find reference to the original question below.

Despite my efforts, I have been unable to align the textarea with the border of the window. In order to create an efficient text editor app, it is crucial for the textarea to match the window size seamlessly. You can access the current version of the app through the link provided below. Although the app functions properly, adjusting the size of the textarea manually is not ideal.

This issue needs to be addressed urgently.

Check out the Chrome App here

Additionally, I am looking to incorporate a "save to disk" button that remains fixed in the bottom right corner of the app interface. Unfortunately, I lack the knowledge on how to implement this feature and would greatly appreciate any assistance available.

Below is the content of the manifest.json file:

{
  "manifest_version": 2,
  "name": "Text Edity",
  "short_name": "TextEdity",
  "description": "A simple text editor, does nothing but edit text!",
  "version": "0.0.1",
  "minimum_chrome_version": "38",

   "icons": {
    "16": "assets/icon_16.png",
    "128": "assets/icon_128.png"
  },

  "app": {
    "background": {
      "scripts": ["background.js"]
    }
  }
}

I have experimented with some JavaScript code, however, it did not yield the desired result. Additionally, if a save button were to be added, there is a concern that users might inadvertently modify or delete it.

document.body.contentEditable='true';document.designMode='on';void 0;

The HTML structure is as follows:

`<!DOCTYPE html>
 <html>
 <head>
  <title>Text Edity</title>
  <link rel="icon" type="image/png" href="text.png">
 </head>  
 <body>
  <textarea cols='95' rows='44' placeholder='Text Edity'></textarea>
 </body>
</html>`

Lastly, here is the content of background.js:

/**
 * Listens for the app launching, then creates the window.
 *
 * @see http://developer.chrome.com/apps/app.runtime.html
 * @see http://developer.chrome.com/apps/app.window.html
 */
chrome.app.runtime.onLaunched.addListener(function(launchData) {
  chrome.app.window.create(
    'index.html',
    {
      id: 'mainWindow',
      bounds: {width: 800, height: 800}
    }
  );
});

Answer №1

To style your textarea with CSS, consider the following:

textarea {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

If you prefer inline styling, you can include it directly in the element like this:

<textarea cols='80' rows='30' placeholder='Enter text here' style='position: absolute; top: 0; left: 0; width: 100%; height: 100%;'></textarea>

You can also style a button in a similar manner:

<button style='position: absolute; bottom: 10px; right: 10px; z-index: 1;'>Submit</button>

Remember, only use the z-index property if you place the button before the textarea. If the button comes after, you can omit it.

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

Unable to click on links due to issues with the CSS and HTML

On my page at , there are links on the right side that I am unable to click. Does anyone know why this might be happening? Content on the Left Side: <nav class="woocommerce-breadcrumb" itemprop="breadcrumb"><a class="home" href="http://artendije ...

Comparing scrollIntoView and moveToElement functions

When working with Selenium WebDriver, there are two primary methods to ensure an element is within the visible area: Scrolling into view: ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element); Using moveToElemen ...

Styling images with text alignment in CSS

I'm trying to figure out how to align an image to the left, some text to the top right, and some text to the bottom right. The parent div contains a background image. <div id="parent" style="background: url(bg.jpg) repeat-x left top"> <i ...

I have successfully implemented a click effect on one image and now I wish to apply the same effect to the remaining images

I've exhausted all my options and still can't crack this puzzle. Let me break it down for you: Upon entering the page, users are greeted with a collection of images each tagged with classes (for example, img01 and img02). When an image is clicke ...

There was a SyntaxError in the PHP code while parsing JSON: it expected a comma or a closing curly brace after a property value in the object at line 1

test.php <?php require_once __DIR__ . '/vendor/autoload.php'; $urlPaczkomaty = "http://api.paczkomaty.pl/?do=listmachines_xml"; $curl = new Curl\Curl(); $curl->get( $urlPaczkomaty ); $xml = simplexml_load_string($cur ...

Experiencing a result of NaN following a mathematical operation on variables

While working with an array obtained from a JSON response, I am encountering NaN after performing addition operations. var a = new Array(); var b = 0; var c = 0; alert(b); for (var x = 0; x < length; x++) { a[x] = response.data[x] } for (var i = 0; ...

Display or hide a div element when hovering over it, while also being able to select the text within

I am trying to display and conceal a tooltip when hovering over an anchor. However, I want the tooltip to remain visible as long as my cursor is on it. Here is the fiddle link $('#showReasonTip').mouseover(function(){ $(this).parent().find(&apo ...

Having trouble loading the JSON file

Having trouble loading a json file, encountering an error saying "TypeError: e is undefined". Not sure if $.each(data.Dishes) is correct or should it be $.each(data.Dishes.Lunch). This is the current script: $(document).ready(function() { $(".lunch_s ...

The jqGrid displaying data with datatype set to "jsonstring" is only showing the first page

When my JqGrid receives data from the server in JSON format, I use the following parameters: _self.GridParams = { rows: 7, page: 1, sidx: '', sord: '' } Once the data is retrieved, it is stored in the variable 'data': Objec ...

Another option for authorizing a document

DISCLAIMER: I am seeking information on technologies for signing a JSON document from the server-side, not recommendations for specific products or services. I want to explore the various options available for signing a JSON document, especially when mult ...

What could be causing my AJAX script to not execute upon form submission?

My form's ajax functionality is not working properly. When I try to submit the form, nothing happens. Can someone please assist me with this issue? $( '#my-form' ) .submit( function( e ) { $.ajax( { url: 'u_mainslid ...

Exploring Angular 2's ngFor Directive with JSON Data

Recently diving into Angular2, I've been trying to extract data from a JSON file. While I have successfully retrieved the file using a REST client, stored it in a local variable within a component, and accessed certain properties of that variable, I&a ...

Customizing the appearance of charts in AngularJS using the Chart.js

I just started experimenting with AngularJS and recently created a horizontal bar chart using Chart.js and HTML. My next step is to make the chart dynamically appear on the page with the help of AngularJS. Can someone please provide some guidance on how I ...

Updating part of a page while also changing the navigation

Apologies in advance, as this is my first attempt at coding a website. I have a specific need where I want to update only one div on my web page when a link in the navigation bar is clicked. <body> <div id="wrapper"> <header id= ...

Encountering an Issue Retrieving JSON Data

This JSON Data File contains information that I need to retrieve, but it seems there is an error: Error: 05-28 12:42:41.691: W/System.err(2887): org.json.JSONException: No value for vehicle_type 05-28 12:42:41.691: W/System.err(2887): at org.js ...

Utilizing JSON Files with C++ Programming

Currently, I am attempting to parse a JSON file using the jsoncpp library. Nevertheless, I am finding it challenging to comprehend its documentation. Can someone simplify and explain its functionality in layman's terms for me? Let's consider a s ...

Populate select2 with the selected value from select1 without the need to refresh the page or click a button

Being a novice in PHP and Javascript, I am looking for a way to populate the "info" select dropdown based on the selected value from the "peoplesnames" dropdown without refreshing the page or using a button. Here's my code: HTML: <select id="peo ...

Guide to implementing a universal animated background with Angular components

I'm having trouble figuring out why, but every time I attempt to use a specific code (for example: https://codepen.io/plavookac/pen/QMwObb), when applying it to my index.html file (the main one), it ends up displaying on top of my content and makes ev ...

Using the jQuery method `fadeToggle` to handle the functionality of multiple buttons toggling hidden text

I am struggling to make fadeToggle work properly. I want to reveal text when clicking on another div. Since I plan to use this for multiple elements, I am looking for a smart and efficient way to handle them all. Here is my current attempt which does not ...

Is there a way to ensure that the Bootstrap toggle starts off in a collapsed state?

I need assistance with creating a toggle feature where clicking on a line of text will reveal more text below, and when clicked again, the extra text collapses. I want the text color to change to blue when collapsed and red when expanded. The only issue is ...