Hi @Lin
 Nice code! I tested as Eric explained and works great!
A good functionality!

--Mohammad

On Saturday, April 11, 2020 at 11:38:15 AM UTC+4:30, Lin Onetwo wrote:
>
> I found $:/tags/StartupAction/Browser will only execute tiddlywi actions, 
> but can't execute javascript.  
> But I have following JS want to execute:
>
> // we won't do copy on select on text editor, otherwise you can't select and 
> override text in the editor or text inputfunction 
> checkIfElementIsEditor(element) {
>   if (!element || !element.className || !element.className.toLowerCase || 
> !element.nodeName) return false;
>   const isEditableElement = ['INPUT', 'TEXTAREA'].includes(element.nodeName);
>
>   const isTextEditor = element.className.toLowerCase().includes('codemirror');
>
>   return isEditableElement || isTextEditor;
> }// Copy on select, copy document selection when mouse button is 
> updocument.addEventListener('mouseup', function onMouseUp() {
>   const elementsUnderMouse = document.querySelectorAll(':hover');
>
>   if (!elementsUnderMouse || 
> Array.from(elementsUnderMouse).some(checkIfElementIsEditor)) return;
>   document.execCommand('copy');
> });
>
>
>
> What could I do?
>
> I'm currently using WebcataLog to inject Userscript before wiki loading
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/5e0521a4-13c8-48a8-a78c-06de9df8e3bb%40googlegroups.com.

Reply via email to