dropdown: value update issue on iOS 13

html: allow `class`, `title` and `style` attributes
This commit is contained in:
bordun 2020-03-24 11:10:01 +01:00
parent ffd3d08579
commit 365cf1a9bc
5 changed files with 25 additions and 7 deletions

View file

@ -1,10 +1,17 @@
# Changelog
## 0.49.12
- bug fixes
- dropdown: value update issue on iOS 13
- widgets
- html: allow `class`, `title` and `style` attributes
## 0.49.11
- bug fixes
- regression (0.49.10) breaking icon with short names (minimum valid length set to 2 characters)
- html widget: content not initialized properly
- html widget: content not initialized properly
## 0.49.10

View file

@ -2,7 +2,7 @@
"name": "open-stage-control",
"productName": "Open Stage Control",
"description": "Libre and modular OSC / MIDI controller",
"version": "0.49.11",
"version": "0.49.12",
"author": {
"name": "Jean-Emmanuel Doucet",
"email": "jean-emmanuel@ammd.net"

View file

@ -2,7 +2,7 @@
var iOS
if (navigator.platform.match(/iPhone|iPod|iPad/)) {
if (navigator.platform.match(/iPhone|iPod|iPad/) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) {
iOS = true

View file

@ -1,7 +1,8 @@
var Widget = require('../common/widget'),
{iconify} = require('../../ui/utils'),
html = require('nanohtml'),
raw = require('nanohtml/raw')
raw = require('nanohtml/raw'),
iOS = require('../../ui/ios')
class Dropdown extends Widget {
@ -81,7 +82,10 @@ class Dropdown extends Widget {
this.value = this.values[i]
if (!options.fromLocal) this.select.selectedIndex = i + 1
if (!options.fromLocal) {
this.select.selectedIndex = i + 1
if (iOS && document.activeElement === this.select) this.select.blur()
}
if (options.send) this.sendValue()
if (options.sync) this.changed(options)

View file

@ -5,7 +5,11 @@ var Widget = require('../common/widget'),
StaticProperties = require('../mixins/static_properties')
var sanitizeOptions = {
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img', 'h1', 'h2']).filter(x=>x!=='iframe')
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img', 'h1', 'h2']).filter(x=>x!=='iframe'),
allowedAttributes: {
'*': [ 'title', 'class', 'style'],
'img': [ 'src' , 'title', 'class', 'style', 'width', 'height']
}
}
class Html extends StaticProperties(Widget, {bypass: true}) {
@ -27,7 +31,10 @@ class Html extends StaticProperties(Widget, {bypass: true}) {
'Allowed HTML tags:',
'  h1-6, blockquote, p, a, ul, ol, nl, li,',
'  b, i, strong, em, strike, code, hr, br, div,',
'  table, thead, img, caption, tbody, tr, th, td, pre'
'  table, thead, img, caption, tbody, tr, th, td, pre',
'Allowed attributes:',
'&nbsp;&nbsp;<*>: class, style, title',
'&nbsp;&nbsp;<img>: src, width, height',
]},
border: {type: 'boolean', value: true, help: 'Set to `false` to disable the borders and background-color'},