Disabling copy operation in QLPreviewController - first-responder

Is there any way to disable copy of content when we are viewing a text file, in QLPreviewController?
I tried to sub-class it and override- canBecomeFirstResponder and returned NO, but it did not work :-(
Please suggest.

Yes, with viewDidAppear you can simply set:
[self.navigationItem setRightBarButtonItem:nil];
And it will just remove the button for exporting from the previewer for you

Related

How to use Image Literal in the latest Xcode version 13?

I have tried the #imageliteral method but it seems to not working also. I need to use many images in an array so is there any alternative to it or not?
Use
#imageLiteral(
without the closing parenthesis, In this way you can add images in Xcode 13.
use #imageLiteral like you did befor but then add the parentheses and you will get a blank image. Then click the image and you probably know what to do after that
Dear #Amish to solve this problem you can use the following instruction:
Syntax:
who.what=value
Image1.image=UIImage(named:"Image2")
write your image name in parentheses

QuillJS - remove formatting when pasting into the editor

I previously used https://github.com/quilljs/quill/issues/1184#issuecomment-403657128 to make sure that no one can paste formatted text in the QuillJS editor, because I would like people to only use the few editing buttons that I enabled from QuillJs. Since then, it stopped working for me. My question is:
is this working for everyone else?
if no, do you know of an alternative?
One thing about https://github.com/quilljs/quill/issues/1184#issuecomment-403657128 that may behave different than you may have expected could be the 'silent'.
"APIs causing text to change may also be called with a "silent" source, in which case text-change will not be emitted. This is not recommended as it will likely break the undo stack and other functions that rely on a full record of text changes." [ https://quilljs.com/docs/api/#events ]
So if you expected to get the text-change event get emitted but do not get it, then change these two lines
this.quill.updateContents(delta, 'silent')
this.quill.setSelection(index, length, 'silent')
like this:
this.quill.updateContents(delta, 'user')
this.quill.setSelection(index, length, 'user')
Then the text-change event will get fired.

how to find the Xpath for below given check box

enter image description here
Please tell me how to get the xpath for check box.
If you are using Chrome browser - one easy way you can use:
Open the Inspect (or just click the F12 key)
Mark the element you need and right click on it (or just right click on the object (the check box) you are looking for)
Choose Copy ---> Copy Xpath
I think the tshirt option is not public yet, did not get it in your site.I tried with shirts, looks like same dev pattern to me, let me know if the solution does not work.
<input id="Classic" class="facetChkBox" type="checkbox" value="brickstyletype:Classic" name=""/>
<label for="Classic"/>
This is the background html code.
As you already know, this is not the classic checkbox html code, so we need to create a xpath for this as shown below
driver.findElement(By.xpath(".//label[#for='Classic']"))
from the point of code reusablity I would suggest a method like this:
public void clickOnCheckbox(String checkbox){
driver.findElement(By.xpath(".//label[#for='"+checkbox+"']")).click();
}
and call it using
clickOnCheckbox("Blousons");
In this way you can use the same code to click on different check boxes, and create a clean code.
to relate more to what I am saying you can go the url
https://www.ajio.com/women-shirts/c/830316016

getting the field values of content types from drupal

Here I want to know how to get the field values of my custom content type 'mypop'. I tried all methods in google but I don't know how to use, for example i tried function node_load, I can't able to know where to write this function, what are the parameters and tried EntityFieldQuery too. Can I know the how to do it in brief explaination.
Thanks in Advance.
Definitely a very broad question. Assuming you have the content type 'mypop' created already, think the easiest steps for you would be to:
Make sure you create some content of that content type
Customize the "Manage Display" on that content type and make sure the fields you want are set to visible there
Once you do this, those fields should be visible when you view the nodes of that content type already. If you want to further customize the view, you should probably customize the template file for that specific content type (there's other options but trying to keep this as simple as possible).
To do this, copy the "node.tpl.php" file you'll find on the modules/node folder to your theme templates folder and change it's name to be "node--mypop.tpl.php".
That way, you'll override Drupal's default display template for that specific content type only. Now you can basically tweak it into anyway you want.
Hope this helps!
Thanks a lot Alberto. Its working now! I have another issue too, it also got cleared and now its working fine !Another issue is javascript called automatically when I open views edit for other contents. Now by doing overriding this template file, it also gets cleared. Thank you !
node_load take node id. So in order to use noad_load() function, you should first retrieve node ids. Better if you use noad_load_multiple().
// Query all of the nids of a particular content type.
$nids = db_select('node', 'n')
->fields('n', array('nid'))
->condition('type', 'Article', '=')
->execute()
->fetchCol();
// Get all of the article nodes.
$nodes = node_load_multiple($nids);
You can see the result by calling print_r($nodes). Just write a normal function in you .module file or .inc file. Call it anywhere, your choice. say, in menu callback.

Add custom link to operations in 'admin/content'

Can someone give me a suggestion on how to add another link to the "operations"-cell on admin/node?
I have written a module which copies a specific node and now i need in addition to the links "edit" and "delete" a "copy"-link.
CanĀ“t find any useful hints in the Drupal API.
The solution is to download admin_menu module. It contains administration views (you also need to enable it in Modules), which changes default content grid to the custom view. You can then go to Views and modify the admin/content view as you want.
If by "admin/node" you actually mean "admin/content/node", I think you're looking for hook_node_operations().
http://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook_node_operations/7

Resources