LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-16-2013, 08:19 PM   #1
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
How do I embed, and USE, the ace editor?


edit: don't use ACE unless you are a javascript expert. I found this alternative that does exactly what i want:

https://github.com/Codiad/Codiad.git


---end edit---


http://ace.c9.io/

This is an editor. It can be embedded. I have done that. Its nice. But it's useless right now.

I have been looking, on and off, for a week for an example that shows how to OPEN and SAVE a file.

This example does not exist as far as i can tell. The documentation just assumes that you are going to copy and paste words into the editor, then copy and paste them out and save them some other way. They don't mention saving or loading AT ALL.

Does anyone explain how to do this like im a 5 year old? I just want to open an existing file on the server, then using POST or whatever, save the file to the server.

editor.html
Code:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title>Editor</title>
  <style type="text/css" media="screen">
    body {
        overflow: hidden;
    }
    
    #editor { 
        margin: 0;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
    }
  </style>
</head>
<body>

<pre id="editor">
apparently this is where the text goes,..

How do i get it here without statically writing it,.. and how do i save the changes?

</pre>
    
<script src="js/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
    var editor = ace.edit("editor");
    editor.setTheme("ace/theme/twilight");
    editor.getSession().setMode("ace/mode/sh");
</script>

</body>
</html>

Last edited by szboardstretcher; 10-16-2013 at 08:59 PM.
 
Old 10-17-2013, 01:02 PM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
You may not like it but there's no simple answer to this question. One way to implement it is to build your own REST API with a server side application which exposes certain limited file based interactions with the editor via an API. Then you could use ajax to query and post data to said API. The API could be storing files in a number of ways (file based on the filesystem, or text in a database). But it will require a little bit of elbow grease to get it done.

You would also have to define and refine your requirements because discovering said API would be easy to do so implementing it in a secure and sane manner is recommended so that your API does not become a hot bed of malware hosted applications using your API for their own purposes.

I see you've found an alternative that works for you however I wanted to answer in case someone wanted some ideas to use with ACE.

Last edited by sag47; 10-17-2013 at 01:04 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
File with .ace hraposo Ubuntu 1 11-10-2006 04:04 AM
ace files rswier Linux - Software 4 06-29-2006 11:55 PM
Ace archives Jeebizz Slackware 3 08-14-2005 03:42 AM
Linking ACE with KDevelop Kavinjka Programming 5 04-28-2004 05:28 AM
.rar and .ace progster Linux - General 3 03-14-2002 10:12 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration