forked from Qortal/qortal-ui
Change to general copy paste
This commit is contained in:
parent
7eeb5e6d2e
commit
d3ff7f72ba
@ -11,12 +11,12 @@ const options = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const aliases = {
|
const aliases = {
|
||||||
'qortal-ui-crypto': 'node_modules/qortal-ui-crypto/api.js'
|
'qortal-ui-crypto': '../../crypto/api.js'
|
||||||
}
|
}
|
||||||
|
|
||||||
const apiComponents = {
|
const apiComponents = {
|
||||||
api: {
|
api: {
|
||||||
file: 'api/api.js',
|
file: '../../crypto/api.js',
|
||||||
className: 'api'
|
className: 'api'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import { installRouter } from 'pwa-helpers/router.js'
|
|||||||
import { connect } from 'pwa-helpers'
|
import { connect } from 'pwa-helpers'
|
||||||
import { store } from '../store.js'
|
import { store } from '../store.js'
|
||||||
import { doNavigate } from '../redux/app/app-actions.js'
|
import { doNavigate } from '../redux/app/app-actions.js'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
import '../plugins/streams.js'
|
import '../plugins/streams.js'
|
||||||
|
|
||||||
import { loadPlugins } from '../plugins/load-plugins.js'
|
import { loadPlugins } from '../plugins/load-plugins.js'
|
||||||
@ -11,9 +12,6 @@ import '../styles/app-styles.js'
|
|||||||
import './login-view/login-view.js'
|
import './login-view/login-view.js'
|
||||||
import './app-view.js'
|
import './app-view.js'
|
||||||
|
|
||||||
import copyTextMenu from '../functional-components/copy-text-menu.js'
|
|
||||||
import framePasteMenu from '../functional-components/frame-paste-menu.js'
|
|
||||||
|
|
||||||
installRouter((location) => store.dispatch(doNavigate(location)))
|
installRouter((location) => store.dispatch(doNavigate(location)))
|
||||||
|
|
||||||
class MainApp extends connect(store)(LitElement) {
|
class MainApp extends connect(store)(LitElement) {
|
||||||
@ -66,46 +64,14 @@ class MainApp extends connect(store)(LitElement) {
|
|||||||
super.connectedCallback()
|
super.connectedCallback()
|
||||||
this.initial = 0
|
this.initial = 0
|
||||||
|
|
||||||
|
if (!isElectron()) {
|
||||||
|
} else {
|
||||||
window.addEventListener('contextmenu', (event) => {
|
window.addEventListener('contextmenu', (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault()
|
||||||
this._textMenu(event);
|
window.electronAPI.showMyMenu()
|
||||||
})
|
})
|
||||||
|
|
||||||
window.addEventListener('click', () => {
|
|
||||||
copyTextMenu.close()
|
|
||||||
framePasteMenu.close()
|
|
||||||
})
|
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
|
||||||
if (e.keyCode === 27) {
|
|
||||||
copyTextMenu.close()
|
|
||||||
framePasteMenu.close()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection !== 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection !== 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
const selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
|
|
||||||
const textMenuObject = { selectedText, eventObject: event }
|
|
||||||
copyTextMenu.open(textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.customElements.define('main-app', MainApp)
|
window.customElements.define('main-app', MainApp)
|
||||||
|
@ -10,7 +10,8 @@ class ShowPlugin extends connect(store)(LitElement) {
|
|||||||
app: { type: Object },
|
app: { type: Object },
|
||||||
pluginConfig: { type: Object },
|
pluginConfig: { type: Object },
|
||||||
url: { type: String },
|
url: { type: String },
|
||||||
linkParam: { type: String }
|
linkParam: { type: String },
|
||||||
|
registeredUrls: { type: Array }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,13 +51,19 @@ class ShowPlugin extends connect(store)(LitElement) {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super()
|
||||||
|
this.registeredUrls = []
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const plugArr = []
|
||||||
|
|
||||||
const plugSrc = (myPlug) => {
|
const plugSrc = (myPlug) => {
|
||||||
return myPlug === undefined ? 'about:blank' : `${window.location.origin}/plugin/${myPlug.domain}/${myPlug.page}${this.linkParam}`
|
return myPlug === undefined ? 'about:blank' : `${window.location.origin}/plugin/${myPlug.domain}/${myPlug.page}${this.linkParam}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const plugArr = []
|
this.registeredUrls.forEach(myPlugArr => {
|
||||||
this.app.registeredUrls.forEach(myPlugArr => {
|
|
||||||
myPlugArr.menus.length === 0 ? plugArr.push(myPlugArr) : myPlugArr.menus.forEach(i => plugArr.push(myPlugArr, i))
|
myPlugArr.menus.length === 0 ? plugArr.push(myPlugArr) : myPlugArr.menus.forEach(i => plugArr.push(myPlugArr, i))
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -75,6 +82,7 @@ class ShowPlugin extends connect(store)(LitElement) {
|
|||||||
type: 'WINDOW',
|
type: 'WINDOW',
|
||||||
source: this.shadowRoot.getElementById('showPluginFrame').contentWindow
|
source: this.shadowRoot.getElementById('showPluginFrame').contentWindow
|
||||||
})
|
})
|
||||||
|
|
||||||
addPluginRoutes(showingPluginEpml)
|
addPluginRoutes(showingPluginEpml)
|
||||||
showingPluginEpml.imReady()
|
showingPluginEpml.imReady()
|
||||||
this.showingPluginEpml = showingPluginEpml
|
this.showingPluginEpml = showingPluginEpml
|
||||||
@ -94,23 +102,35 @@ class ShowPlugin extends connect(store)(LitElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stateChanged(state) {
|
stateChanged(state) {
|
||||||
this.app = state.app
|
|
||||||
this.config = state.config
|
|
||||||
|
|
||||||
const split = state.app.url.split('/')
|
const split = state.app.url.split('/')
|
||||||
|
const newRegisteredUrls = state.app.registeredUrls
|
||||||
|
|
||||||
|
let newUrl, newLinkParam
|
||||||
|
|
||||||
|
if (newRegisteredUrls !== this.registeredUrls) {
|
||||||
|
this.registeredUrls = newRegisteredUrls
|
||||||
|
}
|
||||||
|
|
||||||
if (split[0] === '' && split[1] === 'app' && split[2] === undefined) {
|
if (split[0] === '' && split[1] === 'app' && split[2] === undefined) {
|
||||||
this.url = 'wallet'
|
newUrl = 'wallet'
|
||||||
this.linkParam = ''
|
newLinkParam = ''
|
||||||
} else if (split.length === 5 && split[1] === 'app') {
|
} else if (split.length === 5 && split[1] === 'app') {
|
||||||
this.url = split[2]
|
newUrl = split[2]
|
||||||
this.linkParam = split[3] === undefined ? '' : '?' + split[3] + '/' + split[4]
|
newLinkParam = split[3] === undefined ? '' : '?' + split[3] + '/' + split[4]
|
||||||
} else if (split[1] === 'app') {
|
} else if (split[1] === 'app') {
|
||||||
this.url = split[2]
|
newUrl = split[2]
|
||||||
this.linkParam = ''
|
newLinkParam = ''
|
||||||
} else {
|
} else {
|
||||||
this.url = '404'
|
newUrl = '404'
|
||||||
this.linkParam = ''
|
newLinkParam = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newUrl !== this.url) {
|
||||||
|
this.url = newUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newLinkParam !== this.linkParam) {
|
||||||
|
this.linkParam = newLinkParam
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,6 @@ import {
|
|||||||
loadStateFromLocalStorage,
|
loadStateFromLocalStorage,
|
||||||
saveStateToLocalStorage,
|
saveStateToLocalStorage,
|
||||||
} from '../localStorageHelpers.js'
|
} from '../localStorageHelpers.js'
|
||||||
import copyTextMenu from '../functional-components/copy-text-menu.js'
|
|
||||||
import framePasteMenu from '../functional-components/frame-paste-menu.js'
|
|
||||||
|
|
||||||
const createTransaction = api.createTransaction
|
const createTransaction = api.createTransaction
|
||||||
const processTransaction = api.processTransaction
|
const processTransaction = api.processTransaction
|
||||||
@ -39,10 +37,6 @@ const sendRvn = api.sendRvn
|
|||||||
const sendArrr = api.sendArrr
|
const sendArrr = api.sendArrr
|
||||||
|
|
||||||
export const routes = {
|
export const routes = {
|
||||||
hello: async (req) => {
|
|
||||||
return 'Hello from awesomeness'
|
|
||||||
},
|
|
||||||
|
|
||||||
registerUrl: async (req) => {
|
registerUrl: async (req) => {
|
||||||
store.dispatch(doAddPluginUrl(req.data))
|
store.dispatch(doAddPluginUrl(req.data))
|
||||||
},
|
},
|
||||||
@ -95,27 +89,6 @@ export const routes = {
|
|||||||
return saveStateToLocalStorage(req.data.key, req.data.dataObj)
|
return saveStateToLocalStorage(req.data.key, req.data.dataObj)
|
||||||
},
|
},
|
||||||
|
|
||||||
openCopyTextMenu: async (req) => {
|
|
||||||
const textMenuObject = {
|
|
||||||
selectedText: req.data.selectedText,
|
|
||||||
eventObject: req.data.eventObject,
|
|
||||||
isFrame: req.data.isFrame,
|
|
||||||
}
|
|
||||||
copyTextMenu.open(textMenuObject)
|
|
||||||
},
|
|
||||||
|
|
||||||
closeCopyTextMenu: async (req) => {
|
|
||||||
copyTextMenu.close()
|
|
||||||
},
|
|
||||||
|
|
||||||
openFramePasteMenu: async (req) => {
|
|
||||||
framePasteMenu.open(req.data)
|
|
||||||
},
|
|
||||||
|
|
||||||
closeFramePasteMenu: async (req) => {
|
|
||||||
framePasteMenu.close()
|
|
||||||
},
|
|
||||||
|
|
||||||
apiCall: async (req) => {
|
apiCall: async (req) => {
|
||||||
const url = req.data.url
|
const url = req.data.url
|
||||||
delete req.data.url
|
delete req.data.url
|
||||||
|
@ -7,8 +7,6 @@ const SELECTED_ADDRESS_STREAM_NAME = 'selected_address'
|
|||||||
const APP_INFO_STATE = 'app_info_state'
|
const APP_INFO_STATE = 'app_info_state'
|
||||||
const CHAT_HEADS_STREAM_NAME = 'chat_heads'
|
const CHAT_HEADS_STREAM_NAME = 'chat_heads'
|
||||||
const NODE_CONFIG_STREAM_NAME = 'node_config'
|
const NODE_CONFIG_STREAM_NAME = 'node_config'
|
||||||
const COPY_MENU_SWITCH = 'copy_menu_switch'
|
|
||||||
const FRAME_PASTE_MENU_SWITCH = 'frame_paste_menu_switch'
|
|
||||||
const CHAT_LAST_SEEN = 'chat_last_seen'
|
const CHAT_LAST_SEEN = 'chat_last_seen'
|
||||||
|
|
||||||
export const loggedInStream = new EpmlStream(LOGIN_STREAM_NAME, () => store.getState().app.loggedIn)
|
export const loggedInStream = new EpmlStream(LOGIN_STREAM_NAME, () => store.getState().app.loggedIn)
|
||||||
@ -17,8 +15,6 @@ export const selectedAddressStream = new EpmlStream(SELECTED_ADDRESS_STREAM_NAME
|
|||||||
export const appInfoStateStream = new EpmlStream(APP_INFO_STATE, () => store.getState().app.appInfo)
|
export const appInfoStateStream = new EpmlStream(APP_INFO_STATE, () => store.getState().app.appInfo)
|
||||||
export const chatHeadsStateStream = new EpmlStream(CHAT_HEADS_STREAM_NAME, () => store.getState().app.chatHeads)
|
export const chatHeadsStateStream = new EpmlStream(CHAT_HEADS_STREAM_NAME, () => store.getState().app.chatHeads)
|
||||||
export const nodeConfigStream = new EpmlStream(NODE_CONFIG_STREAM_NAME, () => store.getState().app.nodeConfig)
|
export const nodeConfigStream = new EpmlStream(NODE_CONFIG_STREAM_NAME, () => store.getState().app.nodeConfig)
|
||||||
export const copyMenuSwitchStream = new EpmlStream(COPY_MENU_SWITCH, () => store.getState().app.copyMenuSwitch)
|
|
||||||
export const framePasteMenuSwitchStream = new EpmlStream(FRAME_PASTE_MENU_SWITCH, () => store.getState().app.framePasteMenuSwitch)
|
|
||||||
export const chatLastSeenStream = new EpmlStream(CHAT_LAST_SEEN, () => store.getState().app.chatLastSeen)
|
export const chatLastSeenStream = new EpmlStream(CHAT_LAST_SEEN, () => store.getState().app.chatLastSeen)
|
||||||
|
|
||||||
|
|
||||||
@ -32,7 +28,7 @@ store.subscribe(() => {
|
|||||||
if (oldState.app.loggedIn !== state.app.loggedIn) {
|
if (oldState.app.loggedIn !== state.app.loggedIn) {
|
||||||
loggedInStream.emit(state.app.loggedIn)
|
loggedInStream.emit(state.app.loggedIn)
|
||||||
}
|
}
|
||||||
// This one may be a little on the heavy side...AHHH, NEED TO MOVE STORAGE OF ENCRYPTED SEED. DONE <3
|
|
||||||
if (oldState.config !== state.config) {
|
if (oldState.config !== state.config) {
|
||||||
configStream.emit(state.config)
|
configStream.emit(state.config)
|
||||||
}
|
}
|
||||||
@ -41,13 +37,6 @@ store.subscribe(() => {
|
|||||||
nodeConfigStream.emit(state.app.nodeConfig)
|
nodeConfigStream.emit(state.app.nodeConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldState.app.copyMenuSwitch !== state.app.copyMenuSwitch) {
|
|
||||||
copyMenuSwitchStream.emit(state.app.copyMenuSwitch)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oldState.app.framePasteMenuSwitch !== state.app.framePasteMenuSwitch) {
|
|
||||||
framePasteMenuSwitchStream.emit(state.app.framePasteMenuSwitch)
|
|
||||||
}
|
|
||||||
if (oldState.app.chatLastSeen !== state.app.chatLastSeen) {
|
if (oldState.app.chatLastSeen !== state.app.chatLastSeen) {
|
||||||
chatLastSeenStream.emit(state.app.chatLastSeen)
|
chatLastSeenStream.emit(state.app.chatLastSeen)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Core App Actions here...
|
// Core App Actions here...
|
||||||
import { UPDATE_BLOCK_INFO, UPDATE_NODE_STATUS, UPDATE_NODE_INFO, CHAT_HEADS, ACCOUNT_INFO, COPY_MENU_SWITCH, PASTE_MENU_SWITCH, FRAME_PASTE_MENU_SWITCH, ADD_AUTO_LOAD_IMAGES_CHAT, REMOVE_AUTO_LOAD_IMAGES_CHAT, ALLOW_QAPP_AUTO_AUTH, REMOVE_QAPP_AUTO_AUTH, SET_CHAT_LAST_SEEN, ADD_CHAT_LAST_SEEN, ALLOW_QAPP_AUTO_LISTS, REMOVE_QAPP_AUTO_LISTS } from '../app-action-types.js'
|
import { UPDATE_BLOCK_INFO, UPDATE_NODE_STATUS, UPDATE_NODE_INFO, CHAT_HEADS, ACCOUNT_INFO, ADD_AUTO_LOAD_IMAGES_CHAT, REMOVE_AUTO_LOAD_IMAGES_CHAT, ALLOW_QAPP_AUTO_AUTH, REMOVE_QAPP_AUTO_AUTH, SET_CHAT_LAST_SEEN, ADD_CHAT_LAST_SEEN, ALLOW_QAPP_AUTO_LISTS, REMOVE_QAPP_AUTO_LISTS } from '../app-action-types.js'
|
||||||
|
|
||||||
export const doUpdateBlockInfo = (blockObj) => {
|
export const doUpdateBlockInfo = (blockObj) => {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
@ -66,46 +66,6 @@ const updateAccountInfo = (payload) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const doCopyMenuSwitch = (value) => {
|
|
||||||
return (dispatch, getState) => {
|
|
||||||
dispatch(copyMenuSwitch(value))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const copyMenuSwitch = (payload) => {
|
|
||||||
return {
|
|
||||||
type: COPY_MENU_SWITCH,
|
|
||||||
payload
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const doPasteMenuSwitch = (value) => {
|
|
||||||
return (dispatch, getState) => {
|
|
||||||
dispatch(pasteMenuSwitch(value))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const pasteMenuSwitch = (payload) => {
|
|
||||||
return {
|
|
||||||
type: PASTE_MENU_SWITCH,
|
|
||||||
payload
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export const doFramePasteMenuSwitch = (value) => {
|
|
||||||
return (dispatch, getState) => {
|
|
||||||
dispatch(framePasteMenuSwitch(value))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const framePasteMenuSwitch = (payload) => {
|
|
||||||
return {
|
|
||||||
type: FRAME_PASTE_MENU_SWITCH,
|
|
||||||
payload
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const addAutoLoadImageChat = (payload) => {
|
export const addAutoLoadImageChat = (payload) => {
|
||||||
return {
|
return {
|
||||||
type: ADD_AUTO_LOAD_IMAGES_CHAT,
|
type: ADD_AUTO_LOAD_IMAGES_CHAT,
|
||||||
|
@ -17,9 +17,6 @@ export const PAGE_URL = 'PAGE_URL'
|
|||||||
export const CHAT_HEADS = 'CHAT_HEADS'
|
export const CHAT_HEADS = 'CHAT_HEADS'
|
||||||
export const ACCOUNT_INFO = 'ACCOUNT_INFO'
|
export const ACCOUNT_INFO = 'ACCOUNT_INFO'
|
||||||
export const ADD_NEW_PLUGIN_URL = 'ADD_NEW_PLUGIN_URL'
|
export const ADD_NEW_PLUGIN_URL = 'ADD_NEW_PLUGIN_URL'
|
||||||
export const COPY_MENU_SWITCH = 'COPY_MENU_SWITCH'
|
|
||||||
export const PASTE_MENU_SWITCH = 'PASTE_MENU_SWITCH'
|
|
||||||
export const FRAME_PASTE_MENU_SWITCH = 'FRAME_PASTE_MENU_SWITCH'
|
|
||||||
export const ADD_AUTO_LOAD_IMAGES_CHAT = 'ADD_AUTO_LOAD_IMAGES_CHAT'
|
export const ADD_AUTO_LOAD_IMAGES_CHAT = 'ADD_AUTO_LOAD_IMAGES_CHAT'
|
||||||
export const REMOVE_AUTO_LOAD_IMAGES_CHAT = 'REMOVE_AUTO_LOAD_IMAGES_CHAT'
|
export const REMOVE_AUTO_LOAD_IMAGES_CHAT = 'REMOVE_AUTO_LOAD_IMAGES_CHAT'
|
||||||
export const ALLOW_QAPP_AUTO_AUTH = 'ALLOW_QAPP_AUTO_AUTH'
|
export const ALLOW_QAPP_AUTO_AUTH = 'ALLOW_QAPP_AUTO_AUTH'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// Loading state, login state, isNavDrawOpen state etc. None of this needs to be saved to localstorage.
|
// Loading state, login state, isNavDrawOpen state etc. None of this needs to be saved to localstorage.
|
||||||
import { loadStateFromLocalStorage, saveStateToLocalStorage } from '../../localStorageHelpers.js'
|
import { loadStateFromLocalStorage, saveStateToLocalStorage } from '../../localStorageHelpers.js'
|
||||||
import { LOG_IN, LOG_OUT, NETWORK_CONNECTION_STATUS, INIT_WORKERS, ADD_PLUGIN_URL, ADD_PLUGIN, ADD_NEW_PLUGIN_URL, NAVIGATE, SELECT_ADDRESS, ACCOUNT_INFO, CHAT_HEADS, UPDATE_BLOCK_INFO, UPDATE_NODE_STATUS, UPDATE_NODE_INFO, LOAD_NODE_CONFIG, SET_NODE, ADD_NODE, PAGE_URL, COPY_MENU_SWITCH, PASTE_MENU_SWITCH, FRAME_PASTE_MENU_SWITCH, ADD_AUTO_LOAD_IMAGES_CHAT, REMOVE_AUTO_LOAD_IMAGES_CHAT, ALLOW_QAPP_AUTO_AUTH, REMOVE_QAPP_AUTO_AUTH, SET_CHAT_LAST_SEEN, ADD_CHAT_LAST_SEEN, ALLOW_QAPP_AUTO_LISTS, REMOVE_QAPP_AUTO_LISTS } from './app-action-types.js'
|
import { LOG_IN, LOG_OUT, NETWORK_CONNECTION_STATUS, INIT_WORKERS, ADD_PLUGIN_URL, ADD_PLUGIN, ADD_NEW_PLUGIN_URL, NAVIGATE, SELECT_ADDRESS, ACCOUNT_INFO, CHAT_HEADS, UPDATE_BLOCK_INFO, UPDATE_NODE_STATUS, UPDATE_NODE_INFO, LOAD_NODE_CONFIG, SET_NODE, ADD_NODE, PAGE_URL, ADD_AUTO_LOAD_IMAGES_CHAT, REMOVE_AUTO_LOAD_IMAGES_CHAT, ALLOW_QAPP_AUTO_AUTH, REMOVE_QAPP_AUTO_AUTH, SET_CHAT_LAST_SEEN, ADD_CHAT_LAST_SEEN, ALLOW_QAPP_AUTO_LISTS, REMOVE_QAPP_AUTO_LISTS } from './app-action-types.js'
|
||||||
import { initWorkersReducer } from './reducers/init-workers.js'
|
import { initWorkersReducer } from './reducers/init-workers.js'
|
||||||
import { loginReducer } from './reducers/login-reducer.js'
|
import { loginReducer } from './reducers/login-reducer.js'
|
||||||
import { setNode, addNode } from './reducers/manage-node.js'
|
import { setNode, addNode } from './reducers/manage-node.js'
|
||||||
@ -43,12 +43,6 @@ const INITIAL_STATE = {
|
|||||||
nodeInfo: {},
|
nodeInfo: {},
|
||||||
nodeStatus: {},
|
nodeStatus: {},
|
||||||
pageUrl: '',
|
pageUrl: '',
|
||||||
copyMenuSwitch: false,
|
|
||||||
pasteMenuSwitch: false,
|
|
||||||
framePasteMenuSwitch: {
|
|
||||||
isOpen: false,
|
|
||||||
elementId: ''
|
|
||||||
},
|
|
||||||
autoLoadImageChats: loadStateFromLocalStorage('autoLoadImageChats') || [],
|
autoLoadImageChats: loadStateFromLocalStorage('autoLoadImageChats') || [],
|
||||||
qAPPAutoAuth: loadStateFromLocalStorage('qAPPAutoAuth') || false,
|
qAPPAutoAuth: loadStateFromLocalStorage('qAPPAutoAuth') || false,
|
||||||
qAPPAutoLists: loadStateFromLocalStorage('qAPPAutoLists') || false,
|
qAPPAutoLists: loadStateFromLocalStorage('qAPPAutoLists') || false,
|
||||||
@ -141,21 +135,6 @@ export default (state = INITIAL_STATE, action) => {
|
|||||||
...state,
|
...state,
|
||||||
networkIsConnected: action.payload
|
networkIsConnected: action.payload
|
||||||
}
|
}
|
||||||
case COPY_MENU_SWITCH:
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
copyMenuSwitch: action.payload
|
|
||||||
}
|
|
||||||
case PASTE_MENU_SWITCH:
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
pasteMenuSwitch: action.payload
|
|
||||||
}
|
|
||||||
case FRAME_PASTE_MENU_SWITCH:
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
framePasteMenuSwitch: action.payload
|
|
||||||
}
|
|
||||||
case ADD_AUTO_LOAD_IMAGES_CHAT: {
|
case ADD_AUTO_LOAD_IMAGES_CHAT: {
|
||||||
const findChat = state.autoLoadImageChats.findIndex((chat)=> chat === action.payload)
|
const findChat = state.autoLoadImageChats.findIndex((chat)=> chat === action.payload)
|
||||||
console.log({findChat})
|
console.log({findChat})
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import { store } from '../store.js'
|
import { store } from '../store.js'
|
||||||
import * as api from 'qortal-ui-crypto'
|
import * as api from 'qortal-ui-crypto'
|
||||||
import snackbar from '../functional-components/snackbar.js'
|
import snackbar from '../functional-components/snackbar.js'
|
||||||
import copyTextMenu from '../functional-components/copy-text-menu.js';
|
|
||||||
import framePasteMenu from '../functional-components/frame-paste-menu.js';
|
|
||||||
|
|
||||||
const createTransaction = api.createTransaction
|
const createTransaction = api.createTransaction
|
||||||
const processTransaction = api.processTransaction
|
const processTransaction = api.processTransaction
|
||||||
@ -25,27 +23,6 @@ export const routes = {
|
|||||||
return api.request(url, req.data)
|
return api.request(url, req.data)
|
||||||
},
|
},
|
||||||
|
|
||||||
openCopyTextMenu: async (req) => {
|
|
||||||
const textMenuObject = {
|
|
||||||
selectedText: req.data.selectedText,
|
|
||||||
eventObject: req.data.eventObject,
|
|
||||||
isFrame: req.data.isFrame,
|
|
||||||
};
|
|
||||||
copyTextMenu.open(textMenuObject);
|
|
||||||
},
|
|
||||||
|
|
||||||
closeCopyTextMenu: async (req) => {
|
|
||||||
copyTextMenu.close();
|
|
||||||
},
|
|
||||||
|
|
||||||
openFramePasteMenu: async (req) => {
|
|
||||||
framePasteMenu.open(req.data);
|
|
||||||
},
|
|
||||||
|
|
||||||
closeFramePasteMenu: async (req) => {
|
|
||||||
framePasteMenu.close();
|
|
||||||
},
|
|
||||||
|
|
||||||
transaction: async (req) => {
|
transaction: async (req) => {
|
||||||
let response
|
let response
|
||||||
try {
|
try {
|
||||||
|
16
electron.js
16
electron.js
@ -768,7 +768,7 @@ function createWindow() {
|
|||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
partition: 'persist:webviewsession',
|
partition: 'persist:webviewsession',
|
||||||
nodeIntegration: false,
|
nodeIntegration: true,
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
enableRemoteModule: false,
|
enableRemoteModule: false,
|
||||||
allowRunningInsecureContent: false,
|
allowRunningInsecureContent: false,
|
||||||
@ -933,6 +933,20 @@ if (!isLock) {
|
|||||||
ipcMain.on('check-for-update', (event) => {
|
ipcMain.on('check-for-update', (event) => {
|
||||||
autoUpdater.checkForUpdatesAndNotify()
|
autoUpdater.checkForUpdatesAndNotify()
|
||||||
})
|
})
|
||||||
|
ipcMain.on('show-my-menu', (event) => {
|
||||||
|
log.info("RIGHT CLICKED")
|
||||||
|
let homePageOptions = Menu.buildFromTemplate([
|
||||||
|
{
|
||||||
|
label: 'Copy',
|
||||||
|
role: 'copy'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Paste',
|
||||||
|
role: 'paste'
|
||||||
|
}
|
||||||
|
])
|
||||||
|
homePageOptions.popup(myWindow)
|
||||||
|
})
|
||||||
autoUpdater.on('update-available', (event) => {
|
autoUpdater.on('update-available', (event) => {
|
||||||
const downloadOpts = {
|
const downloadOpts = {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
|
@ -2,5 +2,6 @@ const { contextBridge, ipcRenderer } = require('electron')
|
|||||||
|
|
||||||
contextBridge.exposeInMainWorld('electronAPI', {
|
contextBridge.exposeInMainWorld('electronAPI', {
|
||||||
setStartCore: () => ipcRenderer.send('set-start-core'),
|
setStartCore: () => ipcRenderer.send('set-start-core'),
|
||||||
checkForUpdate: () => ipcRenderer.send('check-for-update')
|
checkForUpdate: () => ipcRenderer.send('check-for-update'),
|
||||||
|
showMyMenu: () => ipcRenderer.send('show-my-menu')
|
||||||
})
|
})
|
19
package.json
19
package.json
@ -73,7 +73,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"axios": "1.4.0",
|
"axios": "1.4.0",
|
||||||
"electron": "24.2.0",
|
"electron": "24.3.0",
|
||||||
"electron-builder": "23.6.0",
|
"electron-builder": "23.6.0",
|
||||||
"electron-packager": "17.1.1",
|
"electron-packager": "17.1.1",
|
||||||
"epml": "0.3.3",
|
"epml": "0.3.3",
|
||||||
@ -83,12 +83,11 @@
|
|||||||
"is-electron": "2.2.2",
|
"is-electron": "2.2.2",
|
||||||
"lit": "2.7.4",
|
"lit": "2.7.4",
|
||||||
"lit-translate": "2.0.1",
|
"lit-translate": "2.0.1",
|
||||||
"localforage": "1.10.0",
|
|
||||||
"pwa-helpers": "0.9.1",
|
"pwa-helpers": "0.9.1",
|
||||||
"passive-events-support": "1.0.33",
|
"passive-events-support": "1.0.33",
|
||||||
"redux": "4.2.1",
|
"redux": "4.2.1",
|
||||||
"redux-thunk": "2.4.2",
|
"redux-thunk": "2.4.2",
|
||||||
"rollup": "3.21.5",
|
"rollup": "3.21.6",
|
||||||
"rollup-plugin-node-globals": "1.4.0",
|
"rollup-plugin-node-globals": "1.4.0",
|
||||||
"rollup-plugin-progress": "1.1.2",
|
"rollup-plugin-progress": "1.1.2",
|
||||||
"rollup-plugin-scss": "3.0.0",
|
"rollup-plugin-scss": "3.0.0",
|
||||||
@ -135,13 +134,13 @@
|
|||||||
"@rollup/plugin-node-resolve": "15.0.2",
|
"@rollup/plugin-node-resolve": "15.0.2",
|
||||||
"@rollup/plugin-replace": "5.0.2",
|
"@rollup/plugin-replace": "5.0.2",
|
||||||
"@rollup/plugin-terser": "0.4.1",
|
"@rollup/plugin-terser": "0.4.1",
|
||||||
"@vaadin/avatar": "24.0.4",
|
"@vaadin/avatar": "24.0.5",
|
||||||
"@vaadin/button": "24.0.4",
|
"@vaadin/button": "24.0.5",
|
||||||
"@vaadin/grid": "24.0.4",
|
"@vaadin/grid": "24.0.5",
|
||||||
"@vaadin/icons": "24.0.4",
|
"@vaadin/icons": "24.0.5",
|
||||||
"@vaadin/password-field": "24.0.4",
|
"@vaadin/password-field": "24.0.5",
|
||||||
"@vaadin/tooltip": "24.0.4",
|
"@vaadin/tooltip": "24.0.5",
|
||||||
"@zip.js/zip.js": "2.7.6"
|
"@zip.js/zip.js": "2.7.13"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.14.0"
|
"node": ">=18.14.0"
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
import { LitElement, html } from 'lit';
|
import { LitElement, html } from 'lit'
|
||||||
import { Epml } from '../../../epml.js';
|
import { Epml } from '../../../epml.js'
|
||||||
import '../components/ButtonIconCopy.js';
|
import '../components/ButtonIconCopy.js'
|
||||||
import { use, translate, registerTranslateConfig } from 'lit-translate';
|
import { use, translate, registerTranslateConfig } from 'lit-translate'
|
||||||
import { blocksNeed } from '../../utils/blocks-needed.js';
|
import { blocksNeed } from '../../utils/blocks-needed.js'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()),
|
loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()),
|
||||||
});
|
})
|
||||||
|
|
||||||
import '@polymer/paper-spinner/paper-spinner-lite.js';
|
import '@polymer/paper-spinner/paper-spinner-lite.js'
|
||||||
import '@material/mwc-button';
|
import '@material/mwc-button'
|
||||||
import '@material/mwc-textfield';
|
import '@material/mwc-textfield'
|
||||||
import '@vaadin/button';
|
import '@vaadin/button'
|
||||||
import { pageStyles } from './become-minter-css.src.js';
|
import { pageStyles } from './become-minter-css.src.js'
|
||||||
import './components/not-sponsored.src';
|
import './components/not-sponsored.src'
|
||||||
import './components/yes-sponsored.src';
|
import './components/yes-sponsored.src'
|
||||||
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent });
|
|
||||||
|
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
|
||||||
|
|
||||||
class BecomeMinter extends LitElement {
|
class BecomeMinter extends LitElement {
|
||||||
static get properties() {
|
static get properties() {
|
||||||
@ -27,77 +28,77 @@ class BecomeMinter extends LitElement {
|
|||||||
addressInfo: { type: Object },
|
addressInfo: { type: Object },
|
||||||
rewardSharePublicKey: { type: String },
|
rewardSharePublicKey: { type: String },
|
||||||
mintingAccountData: { type: Array },
|
mintingAccountData: { type: Array },
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static styles = [pageStyles];
|
static styles = [pageStyles]
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super()
|
||||||
this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light';
|
this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light'
|
||||||
this.sponsorshipKeyValue = '';
|
this.sponsorshipKeyValue = ''
|
||||||
this.isPageLoading = true;
|
this.isPageLoading = true
|
||||||
this.nodeInfo = {};
|
this.nodeInfo = {}
|
||||||
this.addressInfo = {};
|
this.addressInfo = {}
|
||||||
this.rewardSharePublicKey = '';
|
this.rewardSharePublicKey = ''
|
||||||
this.mintingAccountData = null;
|
this.mintingAccountData = null
|
||||||
}
|
}
|
||||||
|
|
||||||
changeLanguage() {
|
changeLanguage() {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage');
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
|
|
||||||
if (checkLanguage === null || checkLanguage.length === 0) {
|
if (checkLanguage === null || checkLanguage.length === 0) {
|
||||||
localStorage.setItem('qortalLanguage', 'us');
|
localStorage.setItem('qortalLanguage', 'us')
|
||||||
use('us');
|
use('us')
|
||||||
} else {
|
} else {
|
||||||
use(checkLanguage);
|
use(checkLanguage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleStorage() {
|
_handleStorage() {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage');
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
const checkTheme = localStorage.getItem('qortalTheme');
|
const checkTheme = localStorage.getItem('qortalTheme')
|
||||||
|
|
||||||
use(checkLanguage);
|
use(checkLanguage)
|
||||||
|
|
||||||
if (checkTheme === 'dark') {
|
if (checkTheme === 'dark') {
|
||||||
this.theme = 'dark';
|
this.theme = 'dark'
|
||||||
} else {
|
} else {
|
||||||
this.theme = 'light';
|
this.theme = 'light'
|
||||||
}
|
}
|
||||||
document.querySelector('html').setAttribute('theme', this.theme);
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
super.connectedCallback();
|
super.connectedCallback()
|
||||||
window.addEventListener('storage', this._handleStorage);
|
window.addEventListener('storage', this._handleStorage)
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
window.removeEventListener('storage', this._handleStorage);
|
window.removeEventListener('storage', this._handleStorage)
|
||||||
super.disconnectedCallback();
|
super.disconnectedCallback()
|
||||||
}
|
}
|
||||||
|
|
||||||
async getNodeInfo() {
|
async getNodeInfo() {
|
||||||
const nodeInfo = await parentEpml.request('apiCall', {
|
const nodeInfo = await parentEpml.request('apiCall', {
|
||||||
url: `/admin/status`,
|
url: `/admin/status`,
|
||||||
});
|
})
|
||||||
|
|
||||||
return nodeInfo;
|
return nodeInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMintingAcccounts() {
|
async getMintingAcccounts() {
|
||||||
const mintingAccountData = await parentEpml.request('apiCall', {
|
const mintingAccountData = await parentEpml.request('apiCall', {
|
||||||
url: `/admin/mintingaccounts`,
|
url: `/admin/mintingaccounts`,
|
||||||
});
|
})
|
||||||
return mintingAccountData;
|
return mintingAccountData
|
||||||
}
|
}
|
||||||
|
|
||||||
async atMount() {
|
async atMount() {
|
||||||
this.changeLanguage();
|
this.changeLanguage()
|
||||||
|
|
||||||
|
|
||||||
this.isPageLoading = true;
|
this.isPageLoading = true
|
||||||
try {
|
try {
|
||||||
const [nodeInfo, myRewardShareArray, mintingaccounts] =
|
const [nodeInfo, myRewardShareArray, mintingaccounts] =
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
@ -107,33 +108,33 @@ class BecomeMinter extends LitElement {
|
|||||||
?.address
|
?.address
|
||||||
),
|
),
|
||||||
this.getMintingAcccounts(),
|
this.getMintingAcccounts(),
|
||||||
]);
|
])
|
||||||
|
|
||||||
this.nodeInfo = nodeInfo;
|
this.nodeInfo = nodeInfo
|
||||||
this.rewardSharePublicKey =
|
this.rewardSharePublicKey =
|
||||||
myRewardShareArray[0]?.rewardSharePublicKey;
|
myRewardShareArray[0]?.rewardSharePublicKey
|
||||||
this.isPageLoading = false;
|
this.isPageLoading = false
|
||||||
this.mintingAccountData = mintingaccounts;
|
this.mintingAccountData = mintingaccounts
|
||||||
this.addressInfo =
|
this.addressInfo =
|
||||||
window.parent.reduxStore.getState().app.accountInfo.addressInfo;
|
window.parent.reduxStore.getState().app.accountInfo.addressInfo
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error)
|
||||||
|
|
||||||
this.isPageLoading = false;
|
this.isPageLoading = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async firstUpdated() {
|
async firstUpdated() {
|
||||||
await this.atMount();
|
await this.atMount()
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRewardShareRelationship(recipientAddress) {
|
async getRewardShareRelationship(recipientAddress) {
|
||||||
const myRewardShareArray = await parentEpml.request('apiCall', {
|
const myRewardShareArray = await parentEpml.request('apiCall', {
|
||||||
type: 'api',
|
type: 'api',
|
||||||
url: `/addresses/rewardshares?recipients=${recipientAddress}`,
|
url: `/addresses/rewardshares?recipients=${recipientAddress}`,
|
||||||
});
|
})
|
||||||
|
|
||||||
return myRewardShareArray;
|
return myRewardShareArray
|
||||||
}
|
}
|
||||||
|
|
||||||
_levelUpBlocks() {
|
_levelUpBlocks() {
|
||||||
@ -141,8 +142,8 @@ class BecomeMinter extends LitElement {
|
|||||||
blocksNeed(0) -
|
blocksNeed(0) -
|
||||||
(this.addressInfo?.blocksMinted +
|
(this.addressInfo?.blocksMinted +
|
||||||
this.addressInfo?.blocksMintedAdjustment)
|
this.addressInfo?.blocksMintedAdjustment)
|
||||||
).toString();
|
).toString()
|
||||||
return countBlocksString;
|
return countBlocksString
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -150,7 +151,7 @@ class BecomeMinter extends LitElement {
|
|||||||
const findMintingAccount = this.mintingAccountData?.find(
|
const findMintingAccount = this.mintingAccountData?.find(
|
||||||
(ma) => ma.recipientAccount === window.parent.reduxStore.getState().app?.selectedAddress
|
(ma) => ma.recipientAccount === window.parent.reduxStore.getState().app?.selectedAddress
|
||||||
?.address
|
?.address
|
||||||
);
|
)
|
||||||
|
|
||||||
const isAlreadySponsored =
|
const isAlreadySponsored =
|
||||||
this.addressInfo?.error !== 124 &&
|
this.addressInfo?.error !== 124 &&
|
||||||
@ -196,8 +197,8 @@ class BecomeMinter extends LitElement {
|
|||||||
</yes-sponsored>
|
</yes-sponsored>
|
||||||
`}
|
`}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.customElements.define('become-minter', BecomeMinter);
|
window.customElements.define('become-minter', BecomeMinter)
|
||||||
|
@ -6,8 +6,8 @@ import { use, translate, registerTranslateConfig } from 'lit-translate';
|
|||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()),
|
loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()),
|
||||||
});
|
});
|
||||||
import '@polymer/paper-spinner/paper-spinner-lite.js';
|
|
||||||
|
|
||||||
|
import '@polymer/paper-spinner/paper-spinner-lite.js';
|
||||||
import '@material/mwc-button';
|
import '@material/mwc-button';
|
||||||
import '@material/mwc-textfield';
|
import '@material/mwc-textfield';
|
||||||
import '@vaadin/button';
|
import '@vaadin/button';
|
||||||
|
@ -478,31 +478,6 @@ class ChatWelcomePage extends LitElement {
|
|||||||
getAddressPublicKey()
|
getAddressPublicKey()
|
||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = "";
|
|
||||||
if (typeof window.getSelection != "undefined") {
|
|
||||||
text = window.getSelection().toString();
|
|
||||||
} else if (typeof this.shadowRoot.selection != "undefined" && this.shadowRoot.selection.type == "Text") {
|
|
||||||
text = this.shadowRoot.selection.createRange().text;
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
_textArea(e) {
|
_textArea(e) {
|
||||||
if (e.keyCode === 13 && !e.shiftKey) this._sendMessage()
|
if (e.keyCode === 13 && !e.shiftKey) this._sendMessage()
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,7 @@ class LevelFounder extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
firstUpdated() {
|
firstUpdated() {
|
||||||
|
this.changeLanguage()
|
||||||
this.checkAddressInfo()
|
this.checkAddressInfo()
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
@ -167,28 +168,6 @@ class LevelFounder extends LitElement {
|
|||||||
` : ''
|
` : ''
|
||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = "";
|
|
||||||
if (typeof window.getSelection != "undefined") {
|
|
||||||
text = window.getSelection().toString();
|
|
||||||
} else if (typeof this.shadowRoot.selection != "undefined" && this.shadowRoot.selection.type == "Text") {
|
|
||||||
text = this.shadowRoot.selection.createRange().text;
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
isEmptyArray(arr) {
|
isEmptyArray(arr) {
|
||||||
if (!arr) { return true }
|
if (!arr) { return true }
|
||||||
return arr.length === 0
|
return arr.length === 0
|
||||||
|
@ -1252,6 +1252,13 @@ class QortalInfoView extends LitElement {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
firstUpdated() {
|
||||||
|
window.addEventListener('contextmenu', (event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
openUserInfo(userData) {
|
openUserInfo(userData) {
|
||||||
if (userData.startsWith('Q') && userData.length == 34) {
|
if (userData.startsWith('Q') && userData.length == 34) {
|
||||||
this.getAddressUserResult(userData)
|
this.getAddressUserResult(userData)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { LitElement, html, css } from 'lit'
|
import { LitElement, html, css } from 'lit'
|
||||||
import { render } from 'lit/html.js'
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
@ -1798,14 +1799,13 @@ class GroupManagement extends LitElement {
|
|||||||
setTimeout(getOpen_JoinedGroups, 600000)
|
setTimeout(getOpen_JoinedGroups, 600000)
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("contextmenu", (event) => {
|
if (!isElectron()) {
|
||||||
event.preventDefault();
|
} else {
|
||||||
this._textMenu(event)
|
window.addEventListener('contextmenu', (event) => {
|
||||||
})
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
window.addEventListener("click", () => {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
@ -1821,12 +1821,6 @@ class GroupManagement extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
|
||||||
if (e.keyCode === 27) {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let configLoaded = false
|
let configLoaded = false
|
||||||
|
|
||||||
parentEpml.ready().then(() => {
|
parentEpml.ready().then(() => {
|
||||||
@ -1844,11 +1838,6 @@ class GroupManagement extends LitElement {
|
|||||||
}
|
}
|
||||||
this.config = JSON.parse(c)
|
this.config = JSON.parse(c)
|
||||||
})
|
})
|
||||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) {
|
|
||||||
this.clearSelection()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
}
|
}
|
||||||
@ -2732,28 +2721,6 @@ class GroupManagement extends LitElement {
|
|||||||
return html`<img src="${url}" onerror="this.src='/img/incognito.png';">`
|
return html`<img src="${url}" onerror="this.src='/img/incognito.png';">`
|
||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = "";
|
|
||||||
if (typeof window.getSelection != "undefined") {
|
|
||||||
text = window.getSelection().toString();
|
|
||||||
} else if (typeof this.shadowRoot.selection != "undefined" && this.shadowRoot.selection.type == "Text") {
|
|
||||||
text = this.shadowRoot.selection.createRange().text;
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
async createGroup(e) {
|
async createGroup(e) {
|
||||||
this.resetDefaultSettings()
|
this.resetDefaultSettings()
|
||||||
const createFeeInput = this.createFee
|
const createFeeInput = this.createFee
|
||||||
@ -3650,11 +3617,6 @@ class GroupManagement extends LitElement {
|
|||||||
return apiKey
|
return apiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
isEmptyArray(arr) {
|
isEmptyArray(arr) {
|
||||||
if (!arr) { return true }
|
if (!arr) { return true }
|
||||||
return arr.length === 0
|
return arr.length === 0
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { LitElement, html, css } from 'lit'
|
import { LitElement, html, css } from 'lit'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
|
|
||||||
class ChainMessaging extends LitElement {
|
class ChainMessaging extends LitElement {
|
||||||
static get properties() {
|
static get properties() {
|
||||||
@ -50,16 +51,12 @@ class ChainMessaging extends LitElement {
|
|||||||
this.changeTheme();
|
this.changeTheme();
|
||||||
}, 100)
|
}, 100)
|
||||||
|
|
||||||
window.addEventListener("contextmenu", (event) => {
|
if (!isElectron()) {
|
||||||
event.preventDefault();
|
} else {
|
||||||
});
|
window.addEventListener('contextmenu', (event) => {
|
||||||
|
event.preventDefault()
|
||||||
window.addEventListener("click", () => {
|
window.parent.electronAPI.showMyMenu()
|
||||||
});
|
})
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
|
||||||
if (e.keyCode === 27) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { LitElement, html, css } from 'lit'
|
import { LitElement, html, css } from 'lit'
|
||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
|
|
||||||
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
|
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
|
||||||
|
|
||||||
@ -144,22 +145,12 @@ class Messaging extends LitElement {
|
|||||||
this.changeTheme();
|
this.changeTheme();
|
||||||
}, 100)
|
}, 100)
|
||||||
|
|
||||||
window.addEventListener("contextmenu", (event) => {
|
if (!isElectron()) {
|
||||||
|
} else {
|
||||||
event.preventDefault();
|
window.addEventListener('contextmenu', (event) => {
|
||||||
this._textMenu(event)
|
event.preventDefault()
|
||||||
});
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
window.addEventListener("click", () => {
|
|
||||||
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
});
|
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
|
||||||
if (e.keyCode === 27) {
|
|
||||||
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let configLoaded = false
|
let configLoaded = false
|
||||||
@ -177,13 +168,6 @@ class Messaging extends LitElement {
|
|||||||
}
|
}
|
||||||
this.config = JSON.parse(c)
|
this.config = JSON.parse(c)
|
||||||
})
|
})
|
||||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
|
||||||
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) {
|
|
||||||
|
|
||||||
this.clearSelection()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
}
|
}
|
||||||
@ -205,40 +189,6 @@ class Messaging extends LitElement {
|
|||||||
onPageNavigation(pageUrl) {
|
onPageNavigation(pageUrl) {
|
||||||
parentEpml.request('setPageUrl', pageUrl)
|
parentEpml.request('setPageUrl', pageUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = "";
|
|
||||||
if (typeof window.getSelection != "undefined") {
|
|
||||||
text = window.getSelection().toString();
|
|
||||||
} else if (typeof this.shadowRoot.selection != "undefined" && this.shadowRoot.selection.type == "Text") {
|
|
||||||
text = this.shadowRoot.selection.createRange().text;
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.customElements.define('q-messaging', Messaging)
|
window.customElements.define('q-messaging', Messaging)
|
||||||
|
@ -9,6 +9,7 @@ import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } fro
|
|||||||
import { qchatStyles } from './q-chat-css.src.js'
|
import { qchatStyles } from './q-chat-css.src.js'
|
||||||
import WebWorker from 'web-worker:./computePowWorker.src.js';
|
import WebWorker from 'web-worker:./computePowWorker.src.js';
|
||||||
import {repeat} from 'lit/directives/repeat.js';
|
import {repeat} from 'lit/directives/repeat.js';
|
||||||
|
import isElectron from 'is-electron'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
||||||
@ -419,8 +420,6 @@ class Chat extends LitElement {
|
|||||||
|
|
||||||
this.shadowRoot.getElementById('messageBox').addEventListener('keydown', stopKeyEventPropagation);
|
this.shadowRoot.getElementById('messageBox').addEventListener('keydown', stopKeyEventPropagation);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const runFunctionsAfterPageLoad = () => {
|
const runFunctionsAfterPageLoad = () => {
|
||||||
// Functions to exec after render while waiting for page info...
|
// Functions to exec after render while waiting for page info...
|
||||||
// getDataFromURL()
|
// getDataFromURL()
|
||||||
@ -443,16 +442,6 @@ class Chat extends LitElement {
|
|||||||
|
|
||||||
let runFunctionsAfterPageLoadInterval = setInterval(runFunctionsAfterPageLoad, 100);
|
let runFunctionsAfterPageLoadInterval = setInterval(runFunctionsAfterPageLoad, 100);
|
||||||
|
|
||||||
window.addEventListener("contextmenu", (event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
this._textMenu(event)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener("click", () => {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
parentEpml.request('closeFramePasteMenu', null)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
const checkTheme = localStorage.getItem('qortalTheme')
|
const checkTheme = localStorage.getItem('qortalTheme')
|
||||||
@ -467,11 +456,12 @@ class Chat extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
if (!isElectron()) {
|
||||||
if (e.keyCode === 27) {
|
} else {
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
window.addEventListener('contextmenu', (event) => {
|
||||||
parentEpml.request('closeFramePasteMenu', null)
|
event.preventDefault()
|
||||||
}
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let configLoaded = false
|
let configLoaded = false
|
||||||
@ -499,20 +489,11 @@ class Chat extends LitElement {
|
|||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.balance = res
|
this.balance = res
|
||||||
})
|
})
|
||||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
|
||||||
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) {
|
|
||||||
|
|
||||||
this.clearSelection()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setOpenPrivateMessage(props) {
|
setOpenPrivateMessage(props) {
|
||||||
this.openPrivateMessage = props.open;
|
this.openPrivateMessage = props.open;
|
||||||
this.shadowRoot.getElementById("sendTo").value = props.name
|
this.shadowRoot.getElementById("sendTo").value = props.name
|
||||||
@ -549,8 +530,6 @@ class Chat extends LitElement {
|
|||||||
window.location.href = `../../group-management/index.html`
|
window.location.href = `../../group-management/index.html`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async _sendMessage(outSideMsg, msg) {
|
async _sendMessage(outSideMsg, msg) {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
|
||||||
@ -914,44 +893,11 @@ class Chat extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = "";
|
|
||||||
if (typeof window.getSelection != "undefined") {
|
|
||||||
text = window.getSelection().toString();
|
|
||||||
} else if (typeof this.shadowRoot.selection != "undefined" && this.shadowRoot.selection.type == "Text") {
|
|
||||||
text = this.shadowRoot.selection.createRange().text;
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
_textArea(e) {
|
_textArea(e) {
|
||||||
|
|
||||||
if (e.keyCode === 13 && !e.shiftKey) this._sendMessage()
|
if (e.keyCode === 13 && !e.shiftKey) this._sendMessage()
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
onPageNavigation(pageUrl) {
|
onPageNavigation(pageUrl) {
|
||||||
parentEpml.request('setPageUrl', pageUrl)
|
parentEpml.request('setPageUrl', pageUrl)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { LitElement, html, css } from 'lit'
|
import { LitElement, html, css } from 'lit'
|
||||||
import { render } from 'lit/html.js'
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
@ -396,7 +397,15 @@ class MintingInfo extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
let configLoaded = false;
|
if (!isElectron()) {
|
||||||
|
} else {
|
||||||
|
window.addEventListener('contextmenu', (event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let configLoaded = false
|
||||||
|
|
||||||
parentEpml.ready().then(() => {
|
parentEpml.ready().then(() => {
|
||||||
parentEpml.subscribe('selected_address', async selectedAddress => {
|
parentEpml.subscribe('selected_address', async selectedAddress => {
|
||||||
@ -418,9 +427,6 @@ class MintingInfo extends LitElement {
|
|||||||
}
|
}
|
||||||
this.config = JSON.parse(c)
|
this.config = JSON.parse(c)
|
||||||
})
|
})
|
||||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) this.clearSelection()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import { LitElement, html, css } from 'lit'
|
|||||||
import { render } from 'lit/html.js'
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
||||||
@ -562,15 +563,6 @@ class NameRegistration extends LitElement {
|
|||||||
setTimeout(fetchMarketSellNames, 180000)
|
setTimeout(fetchMarketSellNames, 180000)
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("contextmenu", (event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
this._textMenu(event)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener("click", () => {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
const checkTheme = localStorage.getItem('qortalTheme')
|
const checkTheme = localStorage.getItem('qortalTheme')
|
||||||
@ -585,10 +577,12 @@ class NameRegistration extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
if (!isElectron()) {
|
||||||
if (e.keyCode === 27) {
|
} else {
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
window.addEventListener('contextmenu', (event) => {
|
||||||
}
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let configLoaded = false
|
let configLoaded = false
|
||||||
@ -608,11 +602,6 @@ class NameRegistration extends LitElement {
|
|||||||
}
|
}
|
||||||
this.config = JSON.parse(c)
|
this.config = JSON.parse(c)
|
||||||
})
|
})
|
||||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) {
|
|
||||||
this.clearSelection()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
}
|
}
|
||||||
@ -870,11 +859,6 @@ class NameRegistration extends LitElement {
|
|||||||
return apiKey
|
return apiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
async registerName(e) {
|
async registerName(e) {
|
||||||
this.error = false
|
this.error = false
|
||||||
this.message = ''
|
this.message = ''
|
||||||
@ -1178,32 +1162,6 @@ class NameRegistration extends LitElement {
|
|||||||
validateReceiver()
|
validateReceiver()
|
||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ""
|
|
||||||
if (typeof window.getSelection != "undefined") {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != "undefined" && this.shadowRoot.selection.type == "Text") {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
round(number) {
|
round(number) {
|
||||||
let result = (Math.round(parseFloat(number) * 1e8) / 1e8).toFixed(8)
|
let result = (Math.round(parseFloat(number) * 1e8) / 1e8).toFixed(8)
|
||||||
return result
|
return result
|
||||||
|
@ -2,7 +2,9 @@ import { LitElement, html, css } from 'lit'
|
|||||||
import { render } from 'lit/html.js'
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
import '../components/qortal-info-view.js'
|
import '../components/qortal-info-view.js'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
||||||
})
|
})
|
||||||
@ -566,15 +568,6 @@ class NamesMarket extends LitElement {
|
|||||||
setTimeout(fetchMarketSoldNames, 300000)
|
setTimeout(fetchMarketSoldNames, 300000)
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("contextmenu", (event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
this._textMenu(event)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener("click", () => {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
const checkTheme = localStorage.getItem('qortalTheme')
|
const checkTheme = localStorage.getItem('qortalTheme')
|
||||||
@ -589,10 +582,12 @@ class NamesMarket extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
if (!isElectron()) {
|
||||||
if (e.keyCode === 27) {
|
} else {
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
window.addEventListener('contextmenu', (event) => {
|
||||||
}
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let configLoaded = false
|
let configLoaded = false
|
||||||
@ -612,11 +607,6 @@ class NamesMarket extends LitElement {
|
|||||||
}
|
}
|
||||||
this.config = JSON.parse(c)
|
this.config = JSON.parse(c)
|
||||||
})
|
})
|
||||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) {
|
|
||||||
this.clearSelection()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
}
|
}
|
||||||
@ -1026,11 +1016,6 @@ class NamesMarket extends LitElement {
|
|||||||
return apiKey
|
return apiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
async createCancelSellName() {
|
async createCancelSellName() {
|
||||||
const name = this.shadowRoot.getElementById("toCancelSellName").value
|
const name = this.shadowRoot.getElementById("toCancelSellName").value
|
||||||
const cancelSellFeeInput = this.cancelSellFee
|
const cancelSellFeeInput = this.cancelSellFee
|
||||||
@ -1171,32 +1156,6 @@ class NamesMarket extends LitElement {
|
|||||||
validateReceiver()
|
validateReceiver()
|
||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ""
|
|
||||||
if (typeof window.getSelection != "undefined") {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != "undefined" && this.shadowRoot.selection.type == "Text") {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
round(number) {
|
round(number) {
|
||||||
let result = (Math.round(parseFloat(number) * 1e8) / 1e8).toFixed(8)
|
let result = (Math.round(parseFloat(number) * 1e8) / 1e8).toFixed(8)
|
||||||
return result
|
return result
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { LitElement, html, css } from 'lit'
|
import { LitElement, html, css } from 'lit'
|
||||||
import { render } from 'lit/html.js'
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
@ -283,22 +284,8 @@ class NodeManagement extends LitElement {
|
|||||||
|
|
||||||
this.changeTheme()
|
this.changeTheme()
|
||||||
this.changeLanguage()
|
this.changeLanguage()
|
||||||
|
|
||||||
// Call updateMintingAccounts
|
|
||||||
this.updateMintingAccounts()
|
this.updateMintingAccounts()
|
||||||
|
|
||||||
window.addEventListener('contextmenu', (event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
this.isTextMenuOpen = true
|
|
||||||
this._textMenu(event)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('click', () => {
|
|
||||||
if (this.isTextMenuOpen) {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
const checkTheme = localStorage.getItem('qortalTheme')
|
const checkTheme = localStorage.getItem('qortalTheme')
|
||||||
@ -313,36 +300,13 @@ class NodeManagement extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
if (!isElectron()) {
|
||||||
if (e.keyCode === 27) {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('addMintingAccountKey').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
} else {
|
||||||
this.myElementId = ''
|
window.addEventListener('contextmenu', (event) => {
|
||||||
this.pasteMenu(event, 'addMintingAccountKey')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('addMintingAccountKey')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
window.parent.electronAPI.showMyMenu()
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate HH MM SS from Milliseconds...
|
// Calculate HH MM SS from Milliseconds...
|
||||||
const convertMsToTime = (milliseconds) => {
|
const convertMsToTime = (milliseconds) => {
|
||||||
@ -414,21 +378,6 @@ class NodeManagement extends LitElement {
|
|||||||
}
|
}
|
||||||
this.config = JSON.parse(c);
|
this.config = JSON.parse(c);
|
||||||
})
|
})
|
||||||
|
|
||||||
parentEpml.subscribe('copy_menu_switch', async (value) => {
|
|
||||||
if (value === 'false' && this.isTextMenuOpen === true) {
|
|
||||||
this.clearSelection()
|
|
||||||
this.isTextMenuOpen = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
parentEpml.subscribe('frame_paste_menu_switch', async res => {
|
|
||||||
res = JSON.parse(res)
|
|
||||||
if (res.isOpen === false && this.isPasteMenuOpen === true) {
|
|
||||||
this.pasteToTextBox(this.myElementId)
|
|
||||||
this.isPasteMenuOpen = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
}
|
}
|
||||||
@ -558,43 +507,6 @@ class NodeManagement extends LitElement {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pasteToTextBox(elementId) {
|
|
||||||
window.focus()
|
|
||||||
navigator.clipboard.readText().then((clipboardText) => {
|
|
||||||
elementId.value += clipboardText
|
|
||||||
elementId.focus()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
pasteMenu(event, elementId) {
|
|
||||||
let eventObject = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY, elementId }
|
|
||||||
parentEpml.request('openFramePasteMenu', eventObject)
|
|
||||||
}
|
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
removeMintingAccount(publicKey) {
|
removeMintingAccount(publicKey) {
|
||||||
this.removeMintingAccountLoading = true;
|
this.removeMintingAccountLoading = true;
|
||||||
|
|
||||||
@ -622,11 +534,6 @@ class NodeManagement extends LitElement {
|
|||||||
return apiKey;
|
return apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
isEmptyArray(arr) {
|
isEmptyArray(arr) {
|
||||||
if (!arr) return true;
|
if (!arr) return true;
|
||||||
return arr.length === 0;
|
return arr.length === 0;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { LitElement, html, css } from 'lit'
|
import { LitElement, html, css } from 'lit'
|
||||||
import { render } from 'lit/html.js'
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
||||||
})
|
})
|
||||||
|
|
||||||
// Not sure if these are imported in the proper way:
|
|
||||||
import nacl from '../../../../crypto/api/deps/nacl-fast.js'
|
import nacl from '../../../../crypto/api/deps/nacl-fast.js'
|
||||||
import Base58 from '../../../../crypto/api/deps/Base58.js'
|
import Base58 from '../../../../crypto/api/deps/Base58.js'
|
||||||
import publicKeyToAddress from '../../../../crypto/api/wallet/publicKeyToAddress.js'
|
import publicKeyToAddress from '../../../../crypto/api/wallet/publicKeyToAddress.js'
|
||||||
@ -184,15 +184,6 @@ class Puzzles extends LitElement {
|
|||||||
this.changeTheme()
|
this.changeTheme()
|
||||||
this.changeLanguage()
|
this.changeLanguage()
|
||||||
|
|
||||||
window.addEventListener("contextmenu", (event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
this._textMenu(event)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener("click", () => {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
const checkTheme = localStorage.getItem('qortalTheme')
|
const checkTheme = localStorage.getItem('qortalTheme')
|
||||||
@ -207,10 +198,12 @@ class Puzzles extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
if (!isElectron()) {
|
||||||
if (e.keyCode === 27) {
|
} else {
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
window.addEventListener('contextmenu', (event) => {
|
||||||
}
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const textBox = this.shadowRoot.getElementById("puzzleGuess")
|
const textBox = this.shadowRoot.getElementById("puzzleGuess")
|
||||||
@ -335,55 +328,8 @@ class Puzzles extends LitElement {
|
|||||||
}
|
}
|
||||||
this.config = JSON.parse(c)
|
this.config = JSON.parse(c)
|
||||||
})
|
})
|
||||||
|
|
||||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) {
|
|
||||||
this.clearSelection()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
parentEpml.subscribe('frame_paste_menu_switch', async res => {
|
|
||||||
res = JSON.parse(res)
|
|
||||||
|
|
||||||
if (res.isOpen === false && this.isPasteMenuOpen === true) {
|
|
||||||
this.pasteToTextBox(textBox)
|
|
||||||
this.isPasteMenuOpen = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
|
|
||||||
textBox.addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = "";
|
|
||||||
|
|
||||||
if (typeof window.getSelection != "undefined") {
|
|
||||||
text = window.getSelection().toString();
|
|
||||||
} else if (typeof this.shadowRoot.selection != "undefined" && this.shadowRoot.selection.type == "Text") {
|
|
||||||
text = this.shadowRoot.selection.createRange().text;
|
|
||||||
}
|
|
||||||
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
// ...
|
|
||||||
} else {
|
|
||||||
this.pasteMenu(event)
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
|
|
||||||
// Prevent Default and Stop Event Bubbling
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changeTheme() {
|
changeTheme() {
|
||||||
@ -486,54 +432,10 @@ class Puzzles extends LitElement {
|
|||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
pasteToTextBox(textBox) {
|
|
||||||
// Return focus to the window
|
|
||||||
window.focus()
|
|
||||||
|
|
||||||
navigator.clipboard.readText().then(clipboardText => {
|
|
||||||
|
|
||||||
textBox.value += clipboardText
|
|
||||||
textBox.focus()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
pasteMenu(event) {
|
|
||||||
let eventObject = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
parentEpml.request('openFramePasteMenu', eventObject)
|
|
||||||
}
|
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = "";
|
|
||||||
if (typeof window.getSelection != "undefined") {
|
|
||||||
text = window.getSelection().toString();
|
|
||||||
} else if (typeof this.shadowRoot.selection != "undefined" && this.shadowRoot.selection.type == "Text") {
|
|
||||||
text = this.shadowRoot.selection.createRange().text;
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
isEmptyArray(arr) {
|
isEmptyArray(arr) {
|
||||||
if (!arr) { return true }
|
if (!arr) { return true }
|
||||||
return arr.length === 0
|
return arr.length === 0
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.customElements.define('puzzles-info', Puzzles)
|
window.customElements.define('puzzles-info', Puzzles)
|
||||||
|
@ -3,6 +3,7 @@ import { render } from 'lit/html.js'
|
|||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
import { columnBodyRenderer, gridRowDetailsRenderer } from '@vaadin/grid/lit.js'
|
import { columnBodyRenderer, gridRowDetailsRenderer } from '@vaadin/grid/lit.js'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
||||||
@ -589,21 +590,6 @@ class QApps extends LitElement {
|
|||||||
setTimeout(getRelayMode, 600000)
|
setTimeout(getRelayMode, 600000)
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("contextmenu", (event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
this._textMenu(event)
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener("click", () => {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
});
|
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
|
||||||
if (e.keyCode === 27) {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
const checkTheme = localStorage.getItem('qortalTheme')
|
const checkTheme = localStorage.getItem('qortalTheme')
|
||||||
@ -618,6 +604,14 @@ class QApps extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!isElectron()) {
|
||||||
|
} else {
|
||||||
|
window.addEventListener('contextmenu', (event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
let configLoaded = false
|
let configLoaded = false
|
||||||
|
|
||||||
parentEpml.ready().then(() => {
|
parentEpml.ready().then(() => {
|
||||||
@ -639,11 +633,6 @@ class QApps extends LitElement {
|
|||||||
}
|
}
|
||||||
this.config = JSON.parse(c)
|
this.config = JSON.parse(c)
|
||||||
})
|
})
|
||||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) {
|
|
||||||
this.clearSelection()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
}
|
}
|
||||||
@ -1197,39 +1186,12 @@ class QApps extends LitElement {
|
|||||||
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]
|
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = "";
|
|
||||||
if (typeof window.getSelection != "undefined") {
|
|
||||||
text = window.getSelection().toString();
|
|
||||||
} else if (typeof this.shadowRoot.selection != "undefined" && this.shadowRoot.selection.type == "Text") {
|
|
||||||
text = this.shadowRoot.selection.createRange().text;
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
getApiKey() {
|
getApiKey() {
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
let apiKey = myNode.apiKey
|
let apiKey = myNode.apiKey
|
||||||
return apiKey
|
return apiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
isEmptyArray(arr) {
|
isEmptyArray(arr) {
|
||||||
if (!arr) { return true }
|
if (!arr) { return true }
|
||||||
return arr.length === 0
|
return arr.length === 0
|
||||||
|
@ -1,31 +1,29 @@
|
|||||||
import { LitElement, html, css } from 'lit';
|
import { LitElement, html, css } from 'lit'
|
||||||
import { render } from 'lit/html.js';
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../../epml';
|
import { Epml } from '../../../../epml'
|
||||||
import {
|
import isElectron from 'is-electron'
|
||||||
use,
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
get,
|
|
||||||
translate,
|
|
||||||
translateUnsafeHTML,
|
|
||||||
registerTranslateConfig,
|
|
||||||
} from 'lit-translate';
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()),
|
loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json())
|
||||||
});
|
})
|
||||||
|
|
||||||
import FileSaver from 'file-saver'
|
import FileSaver from 'file-saver'
|
||||||
import * as actions from '../../components/qdn-action-types';
|
import * as actions from '../../components/qdn-action-types'
|
||||||
import '@material/mwc-button';
|
import '@material/mwc-button'
|
||||||
import '@material/mwc-icon';
|
import '@material/mwc-icon'
|
||||||
import '@material/mwc-checkbox'
|
import '@material/mwc-checkbox'
|
||||||
import WebWorker from 'web-worker:./computePowWorkerFile.src.js';
|
import WebWorker from 'web-worker:./computePowWorkerFile.src.js'
|
||||||
import WebWorkerChat from 'web-worker:./computePowWorker.src.js';
|
import WebWorkerChat from 'web-worker:./computePowWorker.src.js'
|
||||||
import { publishData } from '../../../utils/publish-image.js';
|
import { publishData } from '../../../utils/publish-image.js'
|
||||||
import { Loader } from '../../../utils/loader.js';
|
import { Loader } from '../../../utils/loader.js';
|
||||||
import { QORT_DECIMALS } from '../../../../../crypto/api/constants';
|
import { QORT_DECIMALS } from '../../../../../crypto/api/constants'
|
||||||
import nacl from '../../../../../crypto/api/deps/nacl-fast.js'
|
import nacl from '../../../../../crypto/api/deps/nacl-fast.js'
|
||||||
import ed2curve from '../../../../../crypto/api/deps/ed2curve.js'
|
import ed2curve from '../../../../../crypto/api/deps/ed2curve.js'
|
||||||
import { mimeToExtensionMap } from '../../components/qdn-action-constants';
|
import { mimeToExtensionMap } from '../../components/qdn-action-constants'
|
||||||
import { base64ToUint8Array, encryptData, fileToBase64, uint8ArrayToBase64 } from '../../components/qdn-action-encryption';
|
import { base64ToUint8Array, encryptData, fileToBase64, uint8ArrayToBase64 } from '../../components/qdn-action-encryption'
|
||||||
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent });
|
|
||||||
|
const parentEpml = new Epml({ type: 'WINDOW', source: window.parent })
|
||||||
|
|
||||||
class WebBrowser extends LitElement {
|
class WebBrowser extends LitElement {
|
||||||
static get properties() {
|
static get properties() {
|
||||||
@ -235,14 +233,6 @@ class WebBrowser extends LitElement {
|
|||||||
configLoaded = true;
|
configLoaded = true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
parentEpml.subscribe('copy_menu_switch', async (value) => {
|
|
||||||
if (
|
|
||||||
value === 'false' &&
|
|
||||||
window.getSelection().toString().length !== 0
|
|
||||||
) {
|
|
||||||
this.clearSelection();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -487,15 +477,6 @@ class WebBrowser extends LitElement {
|
|||||||
this.rvnWallet = window.parent.reduxStore.getState().app.selectedAddress.rvnWallet
|
this.rvnWallet = window.parent.reduxStore.getState().app.selectedAddress.rvnWallet
|
||||||
this.arrrWallet = window.parent.reduxStore.getState().app.selectedAddress.arrrWallet
|
this.arrrWallet = window.parent.reduxStore.getState().app.selectedAddress.arrrWallet
|
||||||
|
|
||||||
window.addEventListener('contextmenu', (event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
this._textMenu(event);
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener('click', () => {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null);
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage');
|
const checkLanguage = localStorage.getItem('qortalLanguage');
|
||||||
const checkTheme = localStorage.getItem('qortalTheme');
|
const checkTheme = localStorage.getItem('qortalTheme');
|
||||||
@ -510,11 +491,13 @@ class WebBrowser extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme);
|
document.querySelector('html').setAttribute('theme', this.theme);
|
||||||
});
|
});
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
if (!isElectron()) {
|
||||||
if (e.keyCode === 27) {
|
} else {
|
||||||
parentEpml.request('closeCopyTextMenu', null);
|
window.addEventListener('contextmenu', (event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
window.addEventListener('message', async (event) => {
|
window.addEventListener('message', async (event) => {
|
||||||
if (
|
if (
|
||||||
@ -2814,40 +2797,6 @@ class WebBrowser extends LitElement {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = '';
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString();
|
|
||||||
} else if (
|
|
||||||
typeof this.shadowRoot.selection != 'undefined' &&
|
|
||||||
this.shadowRoot.selection.type == 'Text'
|
|
||||||
) {
|
|
||||||
text = this.shadowRoot.selection.createRange().text;
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
};
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
let _eve = {
|
|
||||||
pageX: event.pageX,
|
|
||||||
pageY: event.pageY,
|
|
||||||
clientX: event.clientX,
|
|
||||||
clientY: event.clientY,
|
|
||||||
};
|
|
||||||
let textMenuObject = {
|
|
||||||
selectedText: selectedText,
|
|
||||||
eventObject: _eve,
|
|
||||||
isFrame: true,
|
|
||||||
};
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
checkSelectedTextAndShowMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
getApiKey() {
|
getApiKey() {
|
||||||
const myNode =
|
const myNode =
|
||||||
window.parent.reduxStore.getState().app.nodeConfig.knownNodes[
|
window.parent.reduxStore.getState().app.nodeConfig.knownNodes[
|
||||||
@ -2856,11 +2805,6 @@ class WebBrowser extends LitElement {
|
|||||||
let apiKey = myNode.apiKey;
|
let apiKey = myNode.apiKey;
|
||||||
return apiKey;
|
return apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges();
|
|
||||||
window.parent.getSelection().removeAllRanges();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.customElements.define('web-browser', WebBrowser);
|
window.customElements.define('web-browser', WebBrowser);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { LitElement, html, css } from 'lit'
|
import { LitElement, html, css } from 'lit'
|
||||||
import { render } from 'lit/html.js'
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../../epml'
|
import { Epml } from '../../../../epml'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
@ -445,15 +446,6 @@ class DataManagement extends LitElement {
|
|||||||
this.changeLanguage()
|
this.changeLanguage()
|
||||||
this.showManagement()
|
this.showManagement()
|
||||||
|
|
||||||
window.addEventListener('contextmenu', (event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
this._textMenu(event)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('click', () => {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
const checkTheme = localStorage.getItem('qortalTheme')
|
const checkTheme = localStorage.getItem('qortalTheme')
|
||||||
@ -468,10 +460,12 @@ class DataManagement extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
if (!isElectron()) {
|
||||||
if (e.keyCode === 27) {
|
} else {
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
window.addEventListener('contextmenu', (event) => {
|
||||||
}
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
let configLoaded = false
|
let configLoaded = false
|
||||||
@ -498,13 +492,6 @@ class DataManagement extends LitElement {
|
|||||||
configLoaded = true
|
configLoaded = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
|
||||||
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) {
|
|
||||||
|
|
||||||
this.clearSelection()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
}
|
}
|
||||||
@ -980,29 +967,6 @@ class DataManagement extends LitElement {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
async getResourcesGrid() {
|
async getResourcesGrid() {
|
||||||
this.resourcesGrid = this.shadowRoot.querySelector(`#resourcesGrid`)
|
this.resourcesGrid = this.shadowRoot.querySelector(`#resourcesGrid`)
|
||||||
this.pagesControl = this.shadowRoot.querySelector('#pages')
|
this.pagesControl = this.shadowRoot.querySelector('#pages')
|
||||||
@ -1123,11 +1087,6 @@ class DataManagement extends LitElement {
|
|||||||
return apiKey;
|
return apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
isEmptyArray(arr) {
|
isEmptyArray(arr) {
|
||||||
if (!arr) { return true }
|
if (!arr) { return true }
|
||||||
return arr.length === 0
|
return arr.length === 0
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { LitElement, html, css } from 'lit'
|
import { LitElement, html, css } from 'lit'
|
||||||
import { render } from 'lit/html.js'
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../../epml'
|
import { Epml } from '../../../../epml'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
@ -241,12 +242,6 @@ class PublishData extends LitElement {
|
|||||||
}
|
}
|
||||||
this.config = JSON.parse(c)
|
this.config = JSON.parse(c)
|
||||||
})
|
})
|
||||||
|
|
||||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) {
|
|
||||||
this.clearSelection()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,15 +322,6 @@ class PublishData extends LitElement {
|
|||||||
this.changeTheme()
|
this.changeTheme()
|
||||||
this.changeLanguage()
|
this.changeLanguage()
|
||||||
|
|
||||||
window.addEventListener('contextmenu', (event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
this._textMenu(event)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('click', () => {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
const checkTheme = localStorage.getItem('qortalTheme')
|
const checkTheme = localStorage.getItem('qortalTheme')
|
||||||
@ -350,10 +336,12 @@ class PublishData extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
if (!isElectron()) {
|
||||||
if (e.keyCode === 27) {
|
} else {
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
window.addEventListener('contextmenu', (event) => {
|
||||||
}
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -679,29 +667,6 @@ class PublishData extends LitElement {
|
|||||||
validate()
|
validate()
|
||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fetchResourceMetadata() {
|
fetchResourceMetadata() {
|
||||||
let identifier = this.identifier != null ? this.identifier : "default"
|
let identifier = this.identifier != null ? this.identifier : "default"
|
||||||
|
|
||||||
@ -736,11 +701,6 @@ class PublishData extends LitElement {
|
|||||||
let apiKey = myNode.apiKey
|
let apiKey = myNode.apiKey
|
||||||
return apiKey
|
return apiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.customElements.define('publish-data', PublishData)
|
window.customElements.define('publish-data', PublishData)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { LitElement, html, css } from 'lit'
|
import { LitElement, html, css } from 'lit'
|
||||||
import { render } from 'lit/html.js'
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
@ -426,21 +427,6 @@ class Websites extends LitElement {
|
|||||||
setTimeout(getRelayMode, 600000)
|
setTimeout(getRelayMode, 600000)
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("contextmenu", (event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
this._textMenu(event)
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener("click", () => {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
});
|
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
|
||||||
if (e.keyCode === 27) {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
const checkTheme = localStorage.getItem('qortalTheme')
|
const checkTheme = localStorage.getItem('qortalTheme')
|
||||||
@ -455,6 +441,14 @@ class Websites extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (!isElectron()) {
|
||||||
|
} else {
|
||||||
|
window.addEventListener('contextmenu', (event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
let configLoaded = false
|
let configLoaded = false
|
||||||
|
|
||||||
parentEpml.ready().then(() => {
|
parentEpml.ready().then(() => {
|
||||||
@ -476,11 +470,6 @@ class Websites extends LitElement {
|
|||||||
}
|
}
|
||||||
this.config = JSON.parse(c)
|
this.config = JSON.parse(c)
|
||||||
})
|
})
|
||||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) {
|
|
||||||
this.clearSelection()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
}
|
}
|
||||||
@ -1101,39 +1090,12 @@ class Websites extends LitElement {
|
|||||||
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]
|
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = "";
|
|
||||||
if (typeof window.getSelection != "undefined") {
|
|
||||||
text = window.getSelection().toString();
|
|
||||||
} else if (typeof this.shadowRoot.selection != "undefined" && this.shadowRoot.selection.type == "Text") {
|
|
||||||
text = this.shadowRoot.selection.createRange().text;
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
getApiKey() {
|
getApiKey() {
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
let apiKey = myNode.apiKey
|
let apiKey = myNode.apiKey
|
||||||
return apiKey
|
return apiKey
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
isEmptyArray(arr) {
|
isEmptyArray(arr) {
|
||||||
if (!arr) { return true }
|
if (!arr) { return true }
|
||||||
return arr.length === 0
|
return arr.length === 0
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { LitElement, html, css } from 'lit'
|
import { LitElement, html, css } from 'lit'
|
||||||
import { render } from 'lit/html.js'
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
@ -214,15 +215,6 @@ class RewardShare extends LitElement {
|
|||||||
this.changeTheme()
|
this.changeTheme()
|
||||||
this.changeLanguage()
|
this.changeLanguage()
|
||||||
|
|
||||||
window.addEventListener("contextmenu", (event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
this._textMenu(event)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener("click", () => {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
const checkTheme = localStorage.getItem('qortalTheme')
|
const checkTheme = localStorage.getItem('qortalTheme')
|
||||||
@ -237,13 +229,13 @@ class RewardShare extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
if (!isElectron()) {
|
||||||
if (e.keyCode === 27) {
|
} else {
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
window.addEventListener('contextmenu', (event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const textBox = this.shadowRoot.getElementById("recipientPublicKey")
|
|
||||||
|
|
||||||
const updateRewardshares = () => {
|
const updateRewardshares = () => {
|
||||||
parentEpml.request('apiCall', {
|
parentEpml.request('apiCall', {
|
||||||
@ -271,51 +263,9 @@ class RewardShare extends LitElement {
|
|||||||
}
|
}
|
||||||
this.config = JSON.parse(c)
|
this.config = JSON.parse(c)
|
||||||
})
|
})
|
||||||
|
|
||||||
parentEpml.subscribe('copy_menu_switch', async value => {
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) {
|
|
||||||
this.clearSelection()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
parentEpml.subscribe('frame_paste_menu_switch', async res => {
|
|
||||||
res = JSON.parse(res)
|
|
||||||
if (res.isOpen === false && this.isPasteMenuOpen === true) {
|
|
||||||
this.pasteToTextBox(textBox)
|
|
||||||
this.isPasteMenuOpen = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
parentEpml.imReady()
|
parentEpml.imReady()
|
||||||
|
|
||||||
textBox.addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = "";
|
|
||||||
if (typeof window.getSelection != "undefined") {
|
|
||||||
text = window.getSelection().toString();
|
|
||||||
} else if (typeof this.shadowRoot.selection != "undefined" && this.shadowRoot.selection.type == "Text") {
|
|
||||||
text = this.shadowRoot.selection.createRange().text;
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
// ...
|
|
||||||
} else {
|
|
||||||
this.pasteMenu(event)
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
|
|
||||||
// Prevent Default and Stop Event Bubbling
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changeTheme() {
|
changeTheme() {
|
||||||
@ -733,57 +683,10 @@ class RewardShare extends LitElement {
|
|||||||
removeReceiver()
|
removeReceiver()
|
||||||
}
|
}
|
||||||
|
|
||||||
pasteToTextBox(textBox) {
|
|
||||||
// Return focus to the window
|
|
||||||
window.focus()
|
|
||||||
|
|
||||||
navigator.clipboard.readText().then(clipboardText => {
|
|
||||||
|
|
||||||
textBox.value += clipboardText
|
|
||||||
textBox.focus()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
pasteMenu(event) {
|
|
||||||
let eventObject = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
parentEpml.request('openFramePasteMenu', eventObject)
|
|
||||||
}
|
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = "";
|
|
||||||
if (typeof window.getSelection != "undefined") {
|
|
||||||
text = window.getSelection().toString();
|
|
||||||
} else if (typeof this.shadowRoot.selection != "undefined" && this.shadowRoot.selection.type == "Text") {
|
|
||||||
text = this.shadowRoot.selection.createRange().text;
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText();
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
isEmptyArray(arr) {
|
isEmptyArray(arr) {
|
||||||
if (!arr) { return true }
|
if (!arr) { return true }
|
||||||
return arr.length === 0
|
return arr.length === 0
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.customElements.define('reward-share', RewardShare)
|
window.customElements.define('reward-share', RewardShare)
|
||||||
|
@ -4,6 +4,7 @@ import "../components/ButtonIconCopy.js"
|
|||||||
import { use, get, translate, registerTranslateConfig } from "lit-translate"
|
import { use, get, translate, registerTranslateConfig } from "lit-translate"
|
||||||
import { blocksNeed } from "../../utils/blocks-needed.js"
|
import { blocksNeed } from "../../utils/blocks-needed.js"
|
||||||
import "../components/ButtonIconCopy.js"
|
import "../components/ButtonIconCopy.js"
|
||||||
|
import isElectron from 'is-electron'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()),
|
loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()),
|
||||||
@ -226,6 +227,13 @@ class SponsorshipList extends LitElement {
|
|||||||
|
|
||||||
async firstUpdated() {
|
async firstUpdated() {
|
||||||
await this.atMount()
|
await this.atMount()
|
||||||
|
if (!isElectron()) {
|
||||||
|
} else {
|
||||||
|
window.addEventListener('contextmenu', (event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRewardShareRelationship(recipientAddress) {
|
async getRewardShareRelationship(recipientAddress) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { LitElement, html, css } from 'lit'
|
import { LitElement, html, css } from 'lit'
|
||||||
import { render } from 'lit/html.js'
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
@ -2036,17 +2037,6 @@ class TradeBotPortal extends LitElement {
|
|||||||
setTimeout(getQortArrrPrice, 300000)
|
setTimeout(getQortArrrPrice, 300000)
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('contextmenu', (event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
this._textMenu(event)},
|
|
||||||
{ passive: true }
|
|
||||||
)
|
|
||||||
|
|
||||||
window.addEventListener('click', () => {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)},
|
|
||||||
{ passive: true }
|
|
||||||
)
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
this.tradeBotBtcBook = JSON.parse(localStorage.getItem(this.btcWallet) || "[]")
|
this.tradeBotBtcBook = JSON.parse(localStorage.getItem(this.btcWallet) || "[]")
|
||||||
this.tradeBotLtcBook = JSON.parse(localStorage.getItem(this.ltcWallet) || "[]")
|
this.tradeBotLtcBook = JSON.parse(localStorage.getItem(this.ltcWallet) || "[]")
|
||||||
@ -2063,8 +2053,12 @@ class TradeBotPortal extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
if (!isElectron()) {
|
||||||
if (e.keyCode === 27) parentEpml.request('closeCopyTextMenu', null)
|
} else {
|
||||||
|
window.addEventListener('contextmenu', (event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.btcWallet = window.parent.reduxStore.getState().app.selectedAddress.btcWallet.address
|
this.btcWallet = window.parent.reduxStore.getState().app.selectedAddress.btcWallet.address
|
||||||
@ -2106,10 +2100,6 @@ class TradeBotPortal extends LitElement {
|
|||||||
this.config = JSON.parse(c)
|
this.config = JSON.parse(c)
|
||||||
})
|
})
|
||||||
|
|
||||||
parentEpml.subscribe('copy_menu_switch', async (value) => {
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) this.clearSelection()
|
|
||||||
})
|
|
||||||
|
|
||||||
let coinSelectionMenu = this.shadowRoot.getElementById("coinSelectionMenu")
|
let coinSelectionMenu = this.shadowRoot.getElementById("coinSelectionMenu")
|
||||||
|
|
||||||
coinSelectionMenu.addEventListener('change', function () {
|
coinSelectionMenu.addEventListener('change', function () {
|
||||||
@ -3352,42 +3342,6 @@ class TradeBotPortal extends LitElement {
|
|||||||
return apiKey;
|
return apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
let _eve = {
|
|
||||||
pageX: event.pageX,
|
|
||||||
pageY: event.pageY,
|
|
||||||
clientX: event.clientX,
|
|
||||||
clientY: event.clientY,
|
|
||||||
}
|
|
||||||
let textMenuObject = {
|
|
||||||
selectedText: selectedText,
|
|
||||||
eventObject: _eve,
|
|
||||||
isFrame: true,
|
|
||||||
}
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
clearTradeBotForm() {
|
clearTradeBotForm() {
|
||||||
this.shadowRoot.getElementById('autoBuy' + this.listedCoins.get(this.selectedCoin).coinCode + 'QortAmountInput').value = this.initialAmount
|
this.shadowRoot.getElementById('autoBuy' + this.listedCoins.get(this.selectedCoin).coinCode + 'QortAmountInput').value = this.initialAmount
|
||||||
this.shadowRoot.getElementById('autoBuy' + this.listedCoins.get(this.selectedCoin).coinCode + 'PriceInput').value = this.initialAmount
|
this.shadowRoot.getElementById('autoBuy' + this.listedCoins.get(this.selectedCoin).coinCode + 'PriceInput').value = this.initialAmount
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { LitElement, html, css } from 'lit'
|
import { LitElement, html, css } from 'lit'
|
||||||
import { render } from 'lit/html.js'
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
@ -1378,17 +1379,6 @@ class TradePortal extends LitElement {
|
|||||||
setTimeout(getQortArrrPrice, 300000)
|
setTimeout(getQortArrrPrice, 300000)
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('contextmenu', (event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
this._textMenu(event)},
|
|
||||||
{ passive: true }
|
|
||||||
)
|
|
||||||
|
|
||||||
window.addEventListener('click', () => {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)},
|
|
||||||
{ passive: true }
|
|
||||||
)
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
const checkTheme = localStorage.getItem('qortalTheme')
|
const checkTheme = localStorage.getItem('qortalTheme')
|
||||||
@ -1399,8 +1389,12 @@ class TradePortal extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
if (!isElectron()) {
|
||||||
if (e.keyCode === 27) parentEpml.request('closeCopyTextMenu', null)
|
} else {
|
||||||
|
window.addEventListener('contextmenu', (event) => {
|
||||||
|
event.preventDefault()
|
||||||
|
window.parent.electronAPI.showMyMenu()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.btcWallet = window.parent.reduxStore.getState().app.selectedAddress.btcWallet.address
|
this.btcWallet = window.parent.reduxStore.getState().app.selectedAddress.btcWallet.address
|
||||||
@ -1443,10 +1437,6 @@ class TradePortal extends LitElement {
|
|||||||
this.config = JSON.parse(c)
|
this.config = JSON.parse(c)
|
||||||
})
|
})
|
||||||
|
|
||||||
parentEpml.subscribe('copy_menu_switch', async (value) => {
|
|
||||||
if (value === 'false' && window.getSelection().toString().length !== 0) this.clearSelection()
|
|
||||||
})
|
|
||||||
|
|
||||||
let coinSelectionMenu = this.shadowRoot.getElementById("coinSelectionMenu")
|
let coinSelectionMenu = this.shadowRoot.getElementById("coinSelectionMenu")
|
||||||
|
|
||||||
coinSelectionMenu.addEventListener('change', function () {
|
coinSelectionMenu.addEventListener('change', function () {
|
||||||
@ -2790,42 +2780,6 @@ class TradePortal extends LitElement {
|
|||||||
return apiKey;
|
return apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
let _eve = {
|
|
||||||
pageX: event.pageX,
|
|
||||||
pageY: event.pageY,
|
|
||||||
clientX: event.clientX,
|
|
||||||
clientY: event.clientY,
|
|
||||||
}
|
|
||||||
let textMenuObject = {
|
|
||||||
selectedText: selectedText,
|
|
||||||
eventObject: _eve,
|
|
||||||
isFrame: true,
|
|
||||||
}
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
clearBuyForm() {
|
clearBuyForm() {
|
||||||
this.shadowRoot.getElementById('buyAmountInput').value = this.initialAmount
|
this.shadowRoot.getElementById('buyAmountInput').value = this.initialAmount
|
||||||
this.shadowRoot.getElementById('buyPriceInput').value = this.initialAmount
|
this.shadowRoot.getElementById('buyPriceInput').value = this.initialAmount
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { LitElement, html, css } from 'lit'
|
import { LitElement, html, css } from 'lit'
|
||||||
import { render } from 'lit/html.js'
|
import { render } from 'lit/html.js'
|
||||||
import { Epml } from '../../../epml.js'
|
import { Epml } from '../../../epml.js'
|
||||||
|
import isElectron from 'is-electron'
|
||||||
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate'
|
||||||
|
|
||||||
registerTranslateConfig({
|
registerTranslateConfig({
|
||||||
@ -756,21 +757,6 @@ class MultiWallet extends LitElement {
|
|||||||
this.wallets.get('rvn').wallet = window.parent.reduxStore.getState().app.selectedAddress.rvnWallet
|
this.wallets.get('rvn').wallet = window.parent.reduxStore.getState().app.selectedAddress.rvnWallet
|
||||||
this.wallets.get('arrr').wallet = window.parent.reduxStore.getState().app.selectedAddress.arrrWallet
|
this.wallets.get('arrr').wallet = window.parent.reduxStore.getState().app.selectedAddress.arrrWallet
|
||||||
})
|
})
|
||||||
|
|
||||||
parentEpml.subscribe('copy_menu_switch', async (value) => {
|
|
||||||
if (value === 'false' && this.isTextMenuOpen === true) {
|
|
||||||
this.clearSelection()
|
|
||||||
this.isTextMenuOpen = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
parentEpml.subscribe('frame_paste_menu_switch', async res => {
|
|
||||||
res = JSON.parse(res)
|
|
||||||
if (res.isOpen === false && this.isPasteMenuOpen === true) {
|
|
||||||
this.pasteToTextBox(this.myElementId)
|
|
||||||
this.isPasteMenuOpen = false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2660,18 +2646,6 @@ class MultiWallet extends LitElement {
|
|||||||
|
|
||||||
this.showWallet()
|
this.showWallet()
|
||||||
|
|
||||||
window.addEventListener('contextmenu', (event) => {
|
|
||||||
event.preventDefault()
|
|
||||||
this.isTextMenuOpen = true
|
|
||||||
this._textMenu(event)
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('click', () => {
|
|
||||||
if (this.isTextMenuOpen) {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
window.addEventListener('storage', () => {
|
window.addEventListener('storage', () => {
|
||||||
const checkLanguage = localStorage.getItem('qortalLanguage')
|
const checkLanguage = localStorage.getItem('qortalLanguage')
|
||||||
const checkTheme = localStorage.getItem('qortalTheme')
|
const checkTheme = localStorage.getItem('qortalTheme')
|
||||||
@ -2686,386 +2660,13 @@ class MultiWallet extends LitElement {
|
|||||||
document.querySelector('html').setAttribute('theme', this.theme)
|
document.querySelector('html').setAttribute('theme', this.theme)
|
||||||
})
|
})
|
||||||
|
|
||||||
window.onkeyup = (e) => {
|
if (!isElectron()) {
|
||||||
if (e.keyCode === 27) {
|
|
||||||
parentEpml.request('closeCopyTextMenu', null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('amountInput').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
} else {
|
||||||
this.myElementId = ''
|
window.addEventListener('contextmenu', (event) => {
|
||||||
this.pasteMenu(event, 'amountInput')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('amountInput')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
window.parent.electronAPI.showMyMenu()
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
this.shadowRoot.getElementById('recipient').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
}
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'recipient')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('recipient')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('btcAmountInput').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'btcAmountInput')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('btcAmountInput')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('btcRecipient').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'btcRecipient')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('btcRecipient')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('ltcAmountInput').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'ltcAmountInput')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('ltcAmountInput')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('ltcRecipient').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'ltcRecipient')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('ltcRecipient')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('dogeAmountInput').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'dogeAmountInput')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('dogeAmountInput')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('dogeRecipient').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'dogeRecipient')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('dogeRecipient')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('dgbAmountInput').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'dgbAmountInput')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('dgbAmountInput')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('dgbRecipient').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'dgbRecipient')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('dgbRecipient')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('rvnAmountInput').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'rvnAmountInput')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('rvnAmountInput')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('rvnRecipient').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'rvnRecipient')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('rvnRecipient')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('arrrAmountInput').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'arrrAmountInput')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('arrrAmountInput')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('arrrRecipient').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'arrrRecipient')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('arrrRecipient')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
|
|
||||||
this.shadowRoot.getElementById('arrrMemo').addEventListener('contextmenu', (event) => {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
} else {
|
|
||||||
this.myElementId = ''
|
|
||||||
this.pasteMenu(event, 'arrrMemo')
|
|
||||||
this.myElementId = this.shadowRoot.getElementById('arrrMemo')
|
|
||||||
this.isPasteMenuOpen = true
|
|
||||||
event.preventDefault()
|
|
||||||
event.stopPropagation()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
renderWarning() {
|
renderWarning() {
|
||||||
@ -4210,19 +3811,6 @@ class MultiWallet extends LitElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pasteToTextBox(elementId) {
|
|
||||||
window.focus()
|
|
||||||
navigator.clipboard.readText().then((clipboardText) => {
|
|
||||||
elementId.value += clipboardText
|
|
||||||
elementId.focus()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
pasteMenu(event, elementId) {
|
|
||||||
let eventObject = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY, elementId }
|
|
||||||
parentEpml.request('openFramePasteMenu', eventObject)
|
|
||||||
}
|
|
||||||
|
|
||||||
async sendQort() {
|
async sendQort() {
|
||||||
const amount = this.shadowRoot.getElementById('amountInput').value
|
const amount = this.shadowRoot.getElementById('amountInput').value
|
||||||
let recipient = this.shadowRoot.getElementById('recipient').value
|
let recipient = this.shadowRoot.getElementById('recipient').value
|
||||||
@ -5649,41 +5237,12 @@ class MultiWallet extends LitElement {
|
|||||||
this.transactionsGrid.items = this.wallets.get(this._selectedWallet).transactions.slice(start, end)
|
this.transactionsGrid.items = this.wallets.get(this._selectedWallet).transactions.slice(start, end)
|
||||||
}
|
}
|
||||||
|
|
||||||
_textMenu(event) {
|
|
||||||
const getSelectedText = () => {
|
|
||||||
var text = ''
|
|
||||||
if (typeof window.getSelection != 'undefined') {
|
|
||||||
text = window.getSelection().toString()
|
|
||||||
} else if (typeof this.shadowRoot.selection != 'undefined' && this.shadowRoot.selection.type == 'Text') {
|
|
||||||
text = this.shadowRoot.selection.createRange().text
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkSelectedTextAndShowMenu = () => {
|
|
||||||
let selectedText = getSelectedText()
|
|
||||||
if (selectedText && typeof selectedText === 'string') {
|
|
||||||
let _eve = { pageX: event.pageX, pageY: event.pageY, clientX: event.clientX, clientY: event.clientY }
|
|
||||||
|
|
||||||
let textMenuObject = { selectedText: selectedText, eventObject: _eve, isFrame: true }
|
|
||||||
|
|
||||||
parentEpml.request('openCopyTextMenu', textMenuObject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
checkSelectedTextAndShowMenu()
|
|
||||||
}
|
|
||||||
|
|
||||||
getApiKey() {
|
getApiKey() {
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node];
|
||||||
let apiKey = myNode.apiKey;
|
let apiKey = myNode.apiKey;
|
||||||
return apiKey;
|
return apiKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearSelection() {
|
|
||||||
window.getSelection().removeAllRanges()
|
|
||||||
window.parent.getSelection().removeAllRanges()
|
|
||||||
}
|
|
||||||
|
|
||||||
transactionItem(transactionObject) {
|
transactionItem(transactionObject) {
|
||||||
return `
|
return `
|
||||||
<div class='transaction-item ${transactionObject.type}'>
|
<div class='transaction-item ${transactionObject.type}'>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user