We are using the draft editor and convertToRaw and convertFromRaw to save and load state from our DB.
For our testing I use factories to create demo data. And want a simple way to generate test data. Simple text is fine.
Is their a function hidden in the library that can help me out?
ideally I could call
textToRaw(`Here is some nice text`)
and that would output something like:
{\"blocks\":[{\"key\":\"4tu7v\",\"text\":\"Here is some nice text\",\"type\":\"unstyled\",\"depth\":0,\"inlineStyleRanges\":[],\"entityRanges\":[],\"data\":{}}],\"entityMap\":{}}
you only need blocks and entityMap. that is simple I think.
convertFromRow({blocks: lines.map(line=>{type:'unstyled', value:line}), entityMap:{}})
Related
I'm trying to make a dialog which shows a dynamic carousel with botkit.
I want the items in this carousel to change according to data on a JSON, I already have a function which creates and updates an "attachmentJSON" variable in the correct format using the data from the original JSON, so it should look something like this:
dialog.ask({ "attachment": attachmentJSON }
The function that updates attachmentJSON is called by several different 'bot.hears' on runtime.
Is there a way to do what I'm trying to do?
I really doubt it's the best solution, but what I ended up doing is creating a function which overwrites the dialog using the updated JSON, and call this "updateConversation" function everytime I need it.
It works at the very least.
The thing is I have found how upload a document and after that downolad it. But I just want to download it. I want to do it using the UI designer but I dont know how to do it.
Thanks :)
I dont know which tool are you using to design your UI, anyway this is concerning functionality, not design. In that point, i need to know wich language do you want (or can) use. For example, in PHP, it's very simple, you can make something like:
(create php file) downloadpdf.php
1st: (if you want to generate pdf "on the fly":
<?php
function download($foo){
content headers (type, force-download, etc)
database select to get data or harcode it.
echo data
}
?>
and call this function with some id to select from database or something (ignore if you want to hardcode it)
Other option to download a file, if it's stored on server is making a link to this file (statically or dyamically). If you wanna take control to file downloads, check this post:
http://www.media-division.com/the-right-way-to-handle-file-downloads-in-php/
I don't mean that it can be done with UI designer tools, and it's not concerned if it's from a form or not.
Cheers!
You should create link and variable which type is javascript expression. On Variable value write
return "/bonita/portal/" + $data.context.mainDoc_ref.url;
On link URL write your variable and to text
Download: {{context.mainDoc_ref.fileName}}
Here you can find excellent example for this case
I am using cucmber+selenium. Is there a way i can pass options to #Cucumber.Options dynamically. Something like-
features="src/YahooSearch.feature" // i want to take this feature file names from excel & put here...
One way of setting it is through the System.setProperties() method.
Say, if my resources/features folder has all the necessary features, I can simply instruct Cucumber to scan for all the features in the folder like,
String features = "/src/main/resources/features";
System.setProperty("cucumber.options", features);
Also, you can instantiate your RuntimeOptions dynamically like
new RuntimeOptions(features);
You could code something simple by passing command line parameters and retrieving them using ENV['xxx'].
Please see this post
Instead of using Junit, use TestNG to invoke feature files. The flow goes like, Read from Excel and with the data generate testng XML suite dynamically to invoke each feature file. Please find the reference below,
https://github.com/sahajamit/cucumber-jvm-testng-integration
Hi everyone I am developing an website and I wanna use one block similarly to this link https://careers.mit.edu/#block-views-facts-block.
Which it contains the flowing text and i liked it by the way so i wanna do it similar to this.
Would be grateful if any one suggest me the right way to do it.
they are using Drupal Views to output a text blocks, after custom animate function in JS/JQuery
check this file
https://careers.mit.edu/sites/default/files/js_injector/js_injector_2.js
Drupal.Careers.scrolling_text_animate
and few more to handle text position ...
animate function is quite big, you can do similar or look for an JQ plugin
I am displaying some data in tabular format. I am trying to add the ability to copy contents of one cell and paste into another. i know I have to do something like
element.on('ctrl-c',function(e){
$scope.textToBeCopied = element.innerHTML;
})
and then let the cursor move to the relevant position and implement a similar paste function.
Those with knowhow of how to implement this feature kindly advice.
I have a plnkr here:
http://plnkr.co/edit/YyZLVKtRAR1OYGey0FYj
figured it out.
Those who wanna take a look or offer a better solution please see the plnkr.co here
http://plnkr.co/edit/YyZLVKtRAR1OYGey0FYj
Focus on the file copyOn.js
This is where I have defined the copy-paste directive