Online file editor [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How can I create an online file editor?
My web application will allow a user to create a new text file, edit it and save it. He can do so with multiple files open in multiple tabs.

If these are only txt files then;
Choose the file store to use. Either store the files in a db or on the file system.
Then all you need to do it load in the file and render it within a textarea and save that back to the file. You may want to keep copies for backup purposes and undo or something.
If you want the file to have nice colors etc then consider a jQuery editor like tinymce.
If however you want to edit any type of doc like word, excel then i think you'll need to use the office object model. but that won't help you with other formats.
As for the tabs, there are heaps of jQuery tab controls out there that will do exactly what you're looking for.

Check out https://bespin.mozillalabs.com/
It is open source.

Related

Draft-js saving and displaying HTML [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'm wondering if anyone came up with any tutorial / walk through for Draft-js to simply save editor state and display it as html to the user. I've been searching and trying and still unable to display html. It seems like most are just saving the editor state and reloading it into the editor instead of displaying it as html.
It seems like most go with convertFromRaw and convertToRaw, but the amount of steps included in that seems like there are quite a few steps that should be simplified, and the example here: https://draftjs.org/docs/api-reference-data-conversion.html#content seems like it's only used to place the content back in the editor later.
Maybe I'm not even looking at the right tool - I simply want an editor to save formatted text and display it. I'm not sure why the resources are so hard to find, or if I'm just looking in the wrong spots (seems like there are too many packages for Draft-js with not much documentation and examples IMO). However, I'm sure this must not be hard to accomplish.
Draftjs is concentrating on displaying rich text within an editor. However, if you want to display the corresponding HTML you have to use an external package called draftjs-export-html.
import {stateToHTML} from 'draft-js-export-html';
you can get the html using let html = stateToHTML(editorState.getCurrentContent(), options); this will do the basic formatting of styles like bold, italic etc. You can also pass your own styling preferences of your draftjs entites using the option parameter.
https://www.npmjs.com/package/draft-js-export-html

Creating pdf file using native js? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
A have a project on angularjs and I need to create and download a document for print(no needed to save it on server). It can be .docx, but .pdf is preferable(so simple user won't able to change file). So, I know that there is a framework called PHPWord, but I don't like php at all. And there is another framework called docx.js(but it jquery required).
There is one more problem that I need to add values of variables to the docx template(which located on server, so admin can change it, of course he won't touch variables in this file) and then download fulfilled pdf document. It is not necessary to use docx template, nevertheless this variant is preferable.
Can you give me some recommendation in which way I need to look? Maybe you know some good framework based on native JS?
I haven't personally used this, but it looks like a contender.
It runs atop Node, so you can leverage your JavaScript skills.
http://pdfkit.org/
https://github.com/devongovett/pdfkit
https://bytescout.com/products/developer/pdfgeneratorsdkjs/create-pdf-tutorial-for-javascript.html please you put a plus. dont forget

Javascript 'Print' button straight to 'Save as PDF' [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to implement a button that will allow users to save a pdf copy of an html page. I know they can go through the 'print' interface, and select the 'save as pdf' option, but I'd rather have my button automatically select that option so that it automatically selects the option 'save as pdf' (or better yet, goes straight to the pdf download).
Is there a way to do this in javascript?
The "Save to PDF" button in the print dialog doesn't exist in Windows afaik.
Anyway, there's no way you can do this with Javascript.
If you really want to give your visitors a PDF download of your page, you need to render that PDF on the server side and link the button to the PDF file.
Why don't you just link the button to a script that converts the page to a PDF. You can either use your own server script to convert the page to PDF or use a save as PDF link to a service like HTM2PDF.
It's not clear in both cases why you would need to utilize JavaScript at all. But if you're really keen on using JavaScript I believe there's something like a 'headless webkit' in JavaScript by the name of PhantomJS.

Is it possible for javascript file to only affect specific DIV [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to use 2 different open source plugins for my website, a gallery and a calendar, both uses JQuery to work.
But when i put both of their javascript together in my website, it clashes and only one will be able to appear.
Is there any ways to specific if that javascript file just works for one DIV only? Or any work around to have both in my website.
Is there any ways to specific if that javascript file just works for one DIV only?
No, there is a single execution environment for a given HTML document. The only way to sandbox JavaScript is to put it in an iframe (even then, there are APIs that allow other documents to be affected)
Or any work around to have both in my website.
Edit the source of the respective scripts to change which elements they affect and to make them use the same version of jQuery and any other libraries they might depend on.

Edit external CSS/SCSS with javascript [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions must demonstrate a minimal understanding of the problem being solved. Tell us what you've tried to do, why it didn't work, and how it should work. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to 'edit' a file that's already saved on my server, example:
<link rel="stylesheet" href="css/plugin.scss">
But not only that, I want to edit a certain specific line, in SASS you can define variables in css, basically, I'd like to search inside this file with JAVASCRIPT for the string:
'$increment:
And if it's found, find out what line it is on and replace that whole line with:
'$increment:10;
Basically I want to generate a downloadable file for the user that's custom depending on what settings they choose via a html input field.
If there's a simpler/better explanation I'm all ears :)
The javascript you seem to be referring to (jQuery) is a client-side language so you're not going to be able to do anything on your server with it. A js solution that could do this may be written in nodejs but you may be better served using something like Python, Rails, or even PHP.

Categories