How can I load local HTML contents to a WebView on UITableViewCell which can be editable too, Such as the mail body of the apple example of the MailComposer. Here we also can get copy paste and magnifier facilities. Please help me with suggestion or with sample codes. I am warned already to be fired by my company. Please please help me.
With the following assumptions:
Users do not need advanced editing features (images, bulleted lists, WYSIWYG anything).
Users do not edit HTML markup.
The HTML only includes text and basic formatting like linebreaks and indents.
I would suggest:
Maintain two versions of your HTML content, one that displays in the UIWebView and on that the user can edit. The editable one should have all markup tags stripped and, where sensible, replaced with their corresponding plaintext character(s) (so for instance, replace <br> with \n).
Load the HTML version of the content into your table as normal (I assume you are already doing this).
When you table goes into editing more, replace (or overlay) the UIWebView with an editable UITextView populated with your non-HTML version of the content.
When the user indicates they are done editing, take the edited version of the text and invert the replacements you did in step #1 (so for instance, replace every \n with <br>).
Load the modified string you got in step #4 into the UIWebView. Optionally save it to file if you want the app to remember/retain a persistent history of edits to the field.
Although, if the company you are working at thinks that the way to motivate engineers is to threaten them with termination, really you should just thank them for their inept management techniques and be on your way.
Related
I have been requested to add some functionality to a Mediawiki page. I am learning MW as fast as I can. We have a MW page with a very large wikitable of bibliographic data. The data is also kept in an external Excel file. It has been requested to add an input field and button so that visitors can search that bibliography and redisplay just the rows that contain a match for the search. I've looked at a lot of extensions and have tried to work out how I could patch together this functionality (Maybe External Data and URLGetParameters but how to do the input field?) I've thought about using an Iframe for the whole thing, and simply do it in PHP using the external spreadsheet but then the information in the IFrame is not visible to the MediaWiki search, yes? Perhaps Javascript/JQuery but I haven't worked out how to execute that on a MW page yet. Does anyone know a proven path for doing this type of thing so I can possibly cut out some of the dead ends I am investigating?
I want to organize my notes (on scientific articles).
I want to be able save text and images notes for each article
Save the pdf file
Organize it into a hierarchy with a document somewhere with a content table containing the hierarchy of thematics and link to all articles
I want to be able to move fast between articles (open note on an article fast)
Add tags to filter the articles
Add an importance level to filter articles
There is many softawre for that kind of thing but it's often difficult to combine pdf file and notes containing text and images and hierarchy and tags
And they are often not really customizable.
The best solution I can think of is to use html files to put the article contents, and other html files with links to the articles pages.
I currently use a python script that I call from command line with pdf download link and article name as argument
The script creates an empty html page for the article at the good place in the hierarchy, add link in the table of content html page, and the article link with his tags in a seperate file
What I would like to do is to have a button in my table of content html page which would allow me to add an article and so add and modify some files.
t's seems that a very specific case because I'm using web like technologies only to organize local files.
But I don't know how to do that and I don't know where to look. Could it be done with javascript or php ? Or may be use something like python dash to display the html page and run some python script in the background
Sorry for my english I'm not a native speaker
I found some app on github that did almost what I want: trilium and pervane
But I didn't use them because they were to complicated for me to customize them to add new functionalities
I finally find a solution by using flask to render my local notes that are stores as html.
I'm using UIWebView to display data from my organization data (publicize and legal), however, for instance, I would only want to pull specific data from the html file rather than pulling the whole URL. e.g. I want to pull the "News" section of the html and I want the user to only stay in that page, not enabling them to go into other parts of the website (e.g. home page, contact us) and allowing them to view the PDF article on the HTML file.
I've asked around and read up on DOM and screen scraping, but it seem that the data pulled are stored in a database instead.
Is there any way that I can pull just the HTML "News" section with the PDF URL into my customized HTML file and that it will be updated live (maybe every 30second it will refresh and pull information from the website so that the content and list of PDF are up to date)(e.g. added in 3new article into the main website, my customize HTML file will also refresh and pull information from website and update my article list)
If anyone can point to me a specific method that allow HTML to HTML data passing (live), that will be great and I can go do more research on it. Currently very lost and confuse as it is my first time doing this. Any help/feedback will be very much appreciated :)
EDIT: For example, google map or google search. I don't want to use the whole google webpage, just taking the important thing that i want like the search result or map display.
This will involve quite a lot of learning on your part - you'll have to learn HTML / the DOM / JavaScript and iOS/UIWebVIew.
Lets leave the live refresh part for now, I'll post another answer or edit to that later on.
That's not going to easy either (check out my earlier posting today on background execution issues that will affect you, unless the update is only to take place in the foreground
iOS Run Code Once a Day)
You will have to do something like this. And note that I've never tried this, nor seen posting of people who have on here, but in theory it should work, but there will be a lot of learning as I've said, and lots of trial and error. Its a big task when you're not familiar with these things.
1) Download the html page and load it in a UIWebView, but that UIWebView is hidden so the user's can't see it.
2) When the page has loaded its dom will be accessable.
3) You can use Javascript to access the DOM and look for the parts you want.
How you inject and run the Javascript in UIWebView can be answered in a separate question (this answer will get too long if all the exact details are included).
4) Remove the parts of the dom you are not interested in. Or use use events to make only those parts you are interested in appear, jQuery can probably help here.
5) Display the UIWebView
Alternatively the HTML could be saved to a file and string parsing could be used to search for the bits you are looking for and create a new text html file from it. I think this would get very messy, better to take advantage of the fact that UIWebView will parse the HTML page and create the dom for you.
My web application has an feature wherein preformatted RTF documents are used as templates and the user can select the source of data and then merge with the RTF documents templates to create merged RTF files. The RTF templates have placeholders which get replaced with user selected content. The final doc can either be saved or opened directly if word/wordpad is available on the local users machine.
Now, I have a requirement to display the merged document to the user for confirmation. The user may either print or save the document to the system directly. The display should not be word/wordpad application but should be within the application itself, using textarea or something similar to render the document. Can you please let me know if its possible to render the RTF document in textarea or not. Along with the displayed content, there should be options to print and save the document.If I have to convert the RTF to Html and then display the html content in textarea , please let me know how i can do the conversion and then display the html in the page.
That's a very difficult requirement. First of all, let's dismiss the idea about a <textarea>, because it does not support any formatting at all. All the WYSIWYG editors you've seen out there are based on <iframe>s.
Secondly, no browser can directly display a RTF. You can embed it as an <object>, and some might show it (IE probably will), but I can't say which ones won't. Portable devices almost certainly won't. But you should test this though, maybe it works well enough after all.
Failing that, HTML conversion is also out of question, because RTF has very very many features that cannot be emulated in HTML. There are some converters out there (google), but but they will all come with serious limitations. If you want full support, you will have to do your own rendering via Canvas or Flash or something.
To this end I'd suggest checking out Google Docs. They've gone through all of this hassle and have a rather feature-full engine for displaying most possible documents. I think it was also possible to embed them in your own webapges, though I've never checked it out myself.
Use a <PRE> tag to Display/Render RTF doc in browser.
I teach GUI and use web pages rather than PP.
I am starting to add HTML5 and CSS instruction to the course.
for a file style_by_kind.html
CSS example style_by_kind.html
when student clicks on the link, obviously, runs the file and displays.
the students can use "save as" in their browser to get a copy for themselves.
I want to display the source as text so I can lecture about the html CSS code.
The link runs the code.
Physically including the file runs the html code.
does not applicable, output only
does not display, comment
Because of continuous updates, it is undesirable to copy the
file with another file type extension, and impossible to "quote" out the html.
Any easy syntax to put in the link or around a physically included copy,
so the student just sees plain text, would be greatly appreciated.
I would suggest changing the extension of the html file to txt.
So when u browse to the txt file, it will still get displayed in the browser with the exact same coding.
Depending on how the files are served up, you might be able to set a ContentType header as text/plain, but I suspect most browsers will still sniff the MIMETYPE of the file and render it as html.
Using the <pre> tag as #hamlin11 suggests is a good idea.
Use <plaintext></plaintext> tags
For example, "This is a lesson on bold tags: <plaintext><b>Bold Text</b></plaintext> will display as <b>Bold Text</b>"