Autodesk forge viewer set toolbar button text without css - autodesk-forge

I have a bunch of buttons I am adding to the toolbar in the viewer that I want text for instead of an icon. For the majority of cases I have been able to just add the text by setting content on the .adsk-button-icon:before which has worked perfectly although im not a huge fan of having the text set in the css file but it works.
I am now looking at adding buttons to the toolbar that will get the text when the viewer is loaded so I can not add the text via css beforehand.
Currently the only way I can see of doing this is creating the styles with JS or adding inline styles with JS which if possible I want to avoid. Is there a way to set a text (or better yet html) to the button or is there a control better suited for this.
https://forge.autodesk.com/en/docs/viewer/v2/reference/javascript/control/

Related

html2canvas text alignment is off

I'm using html2canvas to allow users to download a div element to their local files as an image.
What they are saving is an image with dynamic text on top of it that changes based on their user input (this whole div becomes one image).
The saving part works, and users can save the div as an image to their local files. However, the dynamic text moves downward and the image looks off because of it.
I tried to make changes to html2canvas code based on someone's solution on github, but it didn't work and I reset this code to the original.
Is this a common problem that others have faced? How do I solve this problem without hard-coding the solution (moving the dynamic text up on the web application so when it moves downward when saving, it looks how it's supposed to look)?
Thanks!

ADF RichTextEditor autosubmit doesn't work in Google Chrome

I'm facing a problem when using the RichTextEditor with autosubmit="true" in JDev 12c. The component is added programmatically on a form.
In Firefox the autosubmit fires correctly for any  kind of action (e.g.: typing, changing text style, etc)
On the other side in Chrome, not every action fires the autosubmit. For example, typing some text would fire the autosubmit, but then selecting the text and changing the color or the font size for example, doesn't fire a value change event / autosubmit.
Has anyone else encountered this type of behavior before?
Thanks in advance!
I had the same problem as well, RichTextEditor's text is very difficult to erase the content or reset programatically too,
I advise to use other text tools like the very known RichTextArea:
// Create a rich text area
final RichTextArea rtArea = new RichTextArea();
rtArea .setCaption("My Rich Text Area");
// Set initial content as HTML
rtArea .setValue("<h1>Hello</h1>\n" +
"<p>This rich text area contains some text.</p>");
Then you could resize it to the size of the RichTextEditor and give it the same visual color by some tricks through js and css as usual.

How to prevent title attribute from showing tooltip?

I'm developing a web app using Angular and Semantic-UI.
I'm using Semantic-UI's Popup to show stylish tooltips when users hover some elements.
Anyway I have to add title attribute to be compliant with A11Y (WCAG 2.0) and to make screen readers to read the text content of title attribute.
As you can figure out in this way I get double tooltips for some elements.
Do you know a way to make title attribute to keep text and to stop it from displaying popup?
I don't want remove the text so I can't use removeAttr method provided by jQuery...
There's no way to disable the default browser behaviour, which is to show the title attribute as a "tooltip" in the browser itself.
You'll need to resort to some javascript, it could even be as simple as setting the title to blank on hover, and replacing it on mouse out....
onmouseover="this.setAttribute('data-title', this.title);this.title = ''"
onmouseout="this.setAttribute('title', this.getAttribute('data-title')"
This will set the title to be blank (therefore "disabling" the tooltip), and store it in a data attribute. then on mouseout it will put the title back (meaning your semantic-ui stuff will still work). You will need to integrate this at the correct point in your code of course.

infopath forms textbox word wrap chrome

The textbox in infopath form does not word-wrap the text in Chrome, but does it on IE? I have the multi-line setting checked on the text box. any idea?
Thanks in advance.
Upload a new css file to the “Style Library”.
File should contain the following:
textarea { white-space: pre-wrap !important; word-wrap: break-word
!important; }
Go to Site Settings – Look and Feel – Master Page
Set the Alternate CSS URL to point to the new CSS file that was added to the “Style Library”
Make sure to check “Reset all subsites…..”
Save and issue should be resolved for both Chrome and Firefox
You will have to replace the Text Box Control with a Rich Text Box Control and reconfigure the setting in the new control. You can rename the Rich Text Box control with the same field name after you delete the Text Box Control.
This is just common to Chrome right now, but Edge and Safari, could make the same changes, so might as well make the change to the form. Common to all three is they won't update a form when you make a change to the form.
You can add a "Query a Data Connection Rule" to another control (like a button) and when you use that control it will contact the server and update the form. If you use the same control on different views in the same form it seems to continue working, trial and error on that.
I assume Edge and Safari will make changes similar to Chrome, so you might as well change the Text Box to Rich Text. I have 300 controls to change. Good luck.
I have done it two different ways. I wanted to target only specific forms rather than spend a lot of time on it or do it in master page, I created CSS using Code from solution #1, then dropped it in the site assets library. After that I edited the InfoPath Forms SharePoint Web Part page, added a Content Editor Web Part to the page at bottom after the InfoPath Form Web Part, linked the new Content Editor Web Part to the CSS file, changed the Content Editor Web Part settings to not be seen, etc. and saved the Content Editor Web Part, Then Saved the Web Part Page.
Another way I have done this is added a Rich Text Editor Control to the InfoPath Form, then hide the original Text Box Control and set the Text box control default value to that of the Rich Text Editor Control. Sometimes this is quicker and easier than redoing all the business logic, especially if you are trying to go to PowerApps and get away from InfoPath, don't waste as much time on it. Obviously the drawback is increasing the number of SharePoint fields and fields in the form as well.
Best Regards.
SG.
Add a style.
textarea { white-space: pre-wrap !important; word-wrap: break-word !important; }
using script editor WP

Dynamic Elements in JSP?

I am wondering how to create dynamic elements in a JSP webpage? For example, what I want to do is that I have a Selection Box, in which a user selects an image. Upon clicking a button (or possibly after selecting an item), the image will 'slide down' (like how PPT slides slide down when changing slides) and rest on the center of the screen.
Or at least another simpler case would be, when clicking a button, a text box will appear each time you click the button. So far, the only idea I have of this is by using visibility but that will limit me.
Can you help me on how to do these things or if it is possible to do these with only JSP? Additionally, is it possible for elements to 'pop up' (like in facebook photo viewer) without refreshing the page?
Thank you!
You want things to happen on the client, so you need to be focusing on the HTML, CSS and JavaScript. The fact you generate the HTML using JSP is irrelevant.
Build on things that work
Write JS logic for adding new content based on the form options
Write JS logic for manipulating the CSS to do the animation
Consider using a library such as YUI or jQuery to help with the JS, and using CSS 3 Transitions for the animation.