Format list view and link to OOTB Preview functionality? - json

I have a document library and i have formatted the list view. This works great, however, we lose the OOTB functionality of SharePoint online where you can "preview" the file. This is where it opens in the main window and you can see the file but you also have all the SPO functionality, Share, Move, Copy, information window, version history etc.
How do i edit my Json to link to the OOTB preview? Does anyone have examples of this?

I was looking at it, but it seems that it is not possible to get items url nor parent folder's url using column formatting. I have found somehting at GitHub that mentioned .spItemUrl, but I wasn't able to use it.
The only way, is to create Field Customizer using Javascript, which will give you much broader options. Unfortunately it is not that easy to build as creating column formatting using JSON.
Reference:
https://learn.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/building-simple-field-customizer

Related

Saving static HTML page generated with ReactJS

Background:
I need to allow users to create web pages for various products, with each page having a standard overall appearance. So basically, I will have a template, and based on the input data I need the HTML page to be generated for each product. The input data will be submitted via a web form, following which the data should be merged with the template to produce the output.
I initially considered using a pure templating approach such as Nunjucks, but moved to ReactJS as I have prior experience with the latter.
Problem:
Once I display the output page (by adding the user input to the template file with placeholders), I am getting the desired output page displayed in the browser. But how can I now obtain the HTML code for this specific page?
When I tried to view the source code of the page, I see the contents of 'public/index.html' stating:
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expectedly, the same happens when I try to save (Save As...) the html page via the browser. I understand why the above happens.
But I cannot find a solution to my requirement. Can anyone tell me how I can download/save the static source code for the output page displayed on the browser.
I have read possible solutions such as installing 'React/Redux Development Extension' etc... but these would not work as a solution for external users (who cannot be expected to install these extensions to use my tool). I need a way to do this on production environment.
p.s. Having read the "background" info of my task, do let me know if you can think of any better ways of approaching this.
Edit note:
My app is currently actually just a single page, that accepts user data via a form and displays the output (in a full screen dialog). I don't wish to have these output pages 'published' on the website, and these are simply to be saved/downloaded for internal use. So simply being able to get the "source code" for the dislayed view/page on the browser and saving this to a file would solve my problem. But I am not sure if there is a way to do this?
Its recommended that you use a well-known site generator such as Gatsby or Next for your static sites since "npx create-react-app my-app" is for single page apps.
(ref: https://reactjs.org/docs/create-a-new-react-app.html#recommended-toolchains)
If I'm understanding correctly, you need to generate a new page link for each user. Each of your users will have their own link (http/https) to share with their users.
For example, a scheduling tool will need each user to create their own "booking page", which is a generated link (could be on your domain --> www.yourdomain.com/bookinguser1).
You'll need user profiles to store each user's custom page, a database, and such. If you're not comfortable, I'll use something like an e-commerce tool that will do it for you.
You can turn on the debugger (f12) and go to "Elements"
Then right-click on the HTML tag and press edit as HTML
And then copy everything (ctrl + a)

PhpStorm - print out methods and variables in class files

I have about 10 classes all in individual files. I have not looked at them for ages. Is there a PhpStorm function that would allow me to list the methods and attributes listed in the individual files?
EDIT: The solution is to highlight all the classes you are interested in and then use the diagram tool. See my answer below.
You can use PHPStorm's Structure View:
Use the Structure pop-up window or the Structure tool window to quickly jump to the desired member of a file in the editor. The Structure views provide quick navigation for all supported file types.
You can also use the Structure tool window (Alt+7). This view is flexibly configurable and useful for many tasks, apart from navigation. However, the File Structure pop-up window is the easiest way for quick navigation.
Source https://www.jetbrains.com/phpstorm/help/navigating-with-structure-views.html
Finally discovered what I was looking for.
Highlight all the classes you are interested in in Project view. Right click Diagrams->Show Diagrams (or Ctrl+Alt+Shift+U).
Arrange diagrams on screen.
Select light colored background (Ctrl Backtick) select 5: Look and Feel (not theme).
Right click on diagram and do a print preview. Select Graph for full size. Click OK and make page adjustments. I printed out my 8 classes on an 11 x 17 sheet and I am in "help-my-bad-memory-heaven". Just what I was looking for.
Hope that was useful.
You can use a PHPDoc for that. Generate API doc of your comment doc and you have a offline reference very useful and like your code.
Otherwise, you can attribute a shortcut for launch or focus on the structure view PHPStorm tools.

What are possible ways to read and display .docx/.doc file in editable mode

Using HTML5 File API I am able to read text and XML files without any problems. I have tried to read the .docx/.doc file with the same code and that was not working. In my chrome extension I need to open a .doc/.docx file in editable mode in Google chrome. I am really waiting to know all the possible ways to achieve this. I found some extensions like Google docs viewer etc.. But they are opening files in preview mode. Please help me on this
The .DOC file is binary, and DOCX is a zip file containing a whole collection of XML files that make up a Word document, so neither can easily be read by your straight XML reader.
I don't think there are any native extensions or bits of code for Chrome to edit DOC or DOCX files, so you'd have to write your own - presumably, that's what the extension you're considering would do. You can use the Google docs viewer as a jumping off point - there's no difference between "preview mode" and "edit mode" other than one writes back to the file and the other doesn't. And you'd need to add the controls to modify the document on screen, which may be the larger hurdle.
If you can give some detail on where exactly you're stuck, that might help the community point you towards a solution, but a general "nothing does this for me" is likely to result in a little less help.
Good luck!
you can use jquery for this.
you can use typewith me which is generated in jquery where you can import/export docx,doc.pdf,etc.. files check type with me and private pad
you can use its jquery code for your use as it is opensource.

Is there any way to export time graphs from Chrome developer tool?

I'm using the Chrome developer tools to review a web site for a client, and it would be nice if I could export the results of the time graph.
Is that possible?
Assuming that you're referring to the waterfall chart output in the network panel, you can right-click on the chart's header (or any empty space in the chart itself), and select "Copy network log as HAR" to pull the chart's data into your clipboard.
HAR is a format that lots of tools understand; to generate a nice waterfall chart to discuss with your clients, take a look at something like HAR Viewer. I think that will meet your needs.
This isn't exactly simple but seems to work well enough!
First you need to get the timeline
up in the Dev Tools and right click
somewhere on and "Inspect Element".
This will open another version of
Dev Tools, with the HTML available.
You need to copy this by right
clicking on the <html> tag and
selecting "Copy as HTML".
Paste this into a text editor and save as an html file.
View the following urls in Chrome and save these files to the same place as the html file.
chrome-devtools://devtools/DevTools.js
chrome-devtools://devtools/devTools.css
Change the locations in the <head> tag in the saved html to point to these files.
Save all the images in the resources tab in an "Images" folder in the foot of where this file is. This will take ages, sorry! I think these would all be contained within the Chrome "resources.pak" file which is in Chromes installation directory, however I couldn't find an easy way to extract it.
Viewing your HTML in a browser should show you what you need, obviously once you have extracted the resources, js and css, you can simply copy and paste different versions of the timeline to different HTML files.
If you want a quick and easy way of capturing the data on the network panel you can right-click on any row in the displayed data, select all then copy and paste the contents into Excel.
Excel actually does a good job of capturing the tabulated layout of the data, plus once in Excel you can manipulate the data according to your needs.
One drawback is that it doesn't capture those neat waterfall graphs produced in Chrome but I guess Excel's graphing capability could make up for that!

Is it possible to save changes in Firebug locally?

What I'm trying to do is to save the changes I make to CSS and HTML on different sites with Firebug.
Just to be clear, I don't expect Firebug to upload the changes to the server via FTP or anything. I just want to save the changes locally, so only I will be able to see them.
For example I've seen a few Firefox/Chrome extensions that add a download button under every video on Youtube, so I know it's possible to do that somehow.
If you have a different way to achieve what I'm trying to do, I'll be glad to hear about it.
(It doesn't have to be with Firebug.)
Thanks in advance!
If you don't mind using Web Developer Toolbar it's easy to save changes made to the DOM (and CSS).
When you install the toolbar, you'll get a "View Source" menu, click on that and choose "View generated source". Then just copy and paste that into a .html file.
You did not say if you alter your HTML or CSS, if CSS, FireFile is a very good addon for this.
Edit, with some Googling, i found FireDiff, which states that it can export changes made in Firebug, i have not tested it bit it's worth checking out.
You could try using Greasemonkey.
It has support for adding custom scripts that are run whenever you load a page (linked to which pages it should load on) and that can make changes to the page dynamically.
https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
The http://chrispederick.com/work/web-developer/ web developer toolbar will let you add a user style sheet to a site which should achieve your goals.
This may or may not be exactly what you're asking for, but you can download the extension FireDiff in order to save changes made with FireBug. I made a little tutorial on how to do it here: https://www.youtube.com/watch?v=m4OmZLX2zd4
I have a somewhat simlar use-case that I solved differently. I'm not sure if it is what you are looking for or not. I'll describe the behavior and if that is helpful I'll explain exactly how I implemented it.
I changed the code that execute when you click "Run" (or Ctrl+Enter) to check to see if the first line of the code is a hard-coded string //LoadFromFile:<file path>. If it is, and the file exists then I pull the file off of the local file system and run it instead of executing the code in the console window. This way I can use an external text editor to write code.