Skip to content

Commit 968f3e2

Browse files
authored
Merge pull request #628 from Tencent/dev
v3.15.1
2 parents 05d8039 + 84b4c22 commit 968f3e2

20 files changed

+394
-227
lines changed

CHANGELOG.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
English | [简体中文](./CHANGELOG_CN.md)
22

3+
## 3.15.1 (2023-06-01)
4+
5+
- `Feat(Netwrk)` Add new option `network.ignoreUrlRegExp` to skip some requests. (PR #623)
6+
- `Fix(Core)` Fix prototype pollution in `vConsole.setOption()`. (issue #616 #621)
7+
- `Fix(Core)` Fix plugin event `ready` triggering before its HTML finishes rendering. (issue #591)
8+
- `Fix(Log)` Reset group state when `console.clear()` is called. (issue #611)
9+
- `Fix(Log)` Compatible with iOS (less than 13.4) that does not support `ResizeObserver`, but there may be a potential performance issue when printing a large number of logs. (issue #610)
10+
- `Fix(Network)` Fix possible "Cannot read property" error by `sendBeacon`. (issue #615)
11+
12+
313
## 3.15.0 (2022-11-02)
414

515
- `Feat(Log)` Add recycle scrolling to imporove performance, and add scroll to top/bottom buttons. (PR #570)
@@ -77,7 +87,7 @@ English | [简体中文](./CHANGELOG_CN.md)
7787

7888
## 3.13.0 (2022-03-15)
7989

80-
- `Feat(Log)` Add new option `log.showTimestames`, see [Public Properties & Methods](./doc/public_properties_methods.md).
90+
- `Feat(Log)` Add new option `log.showTimestamps`, see [Public Properties & Methods](./doc/public_properties_methods.md).
8191
- `Fix(Core)` Use polyfill `click` event to prevent raw click event not working in some cases.
8292
- `Fix(style)` Fix CSS transition failure in WeChat webview by using `bottom` instead of `transform`.
8393
- `Fix(Core)` Fix error when calling vConsole method in `onReady` callback. (issue #516)

CHANGELOG_CN.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
[English](./CHANGELOG.md) | 简体中文
22

3+
## 3.15.1 (2023-06-01)
4+
5+
- `Feat(Netwrk)` 新增配置项 `network.ignoreUrlRegExp` 以跳过一些请求。 (PR #623)
6+
- `Fix(Core)` 修复 `vConsole.setOption()` 中可能存在的原型污染问题。 (issue #616 #621)
7+
- `Fix(Core)` 修复插件事件 `ready` 在插件完成渲染前就被触发的问题。 (issue #591)
8+
- `Fix(Log)` 修复调用 `console.clear()` 时没有重置 group 层级的问题。 (issue #611)
9+
- `Fix(Log)` 兼容 iOS(小于 13.4)不支持 `ResizeObserver` 的情况,代价是打印大批量日志可能会有性能问题。 (issue #610)
10+
- `Fix(Network)` 修复可能由 `sendBeacon` 引发的 "Cannot read property" 错误。 (issue #615)
11+
12+
313
## 3.15.0 (2022-11-02)
414

515
- `Feat(Log)` 新增虚拟滚动列表以提升性能,并支持快速滚动到顶部/底部。 (PR #570)
@@ -77,7 +87,7 @@
7787

7888
## 3.13.0 (2022-03-15)
7989

80-
- `Feat(Log)` 新增配置项 `log.showTimestames`,见 [公共属性及方法](./doc/public_properties_methods_CN.md)
90+
- `Feat(Log)` 新增配置项 `log.showTimestamps`,见 [公共属性及方法](./doc/public_properties_methods_CN.md)
8191
- `Fix(Core)` 使用模拟的 `click` 事件以避免某些场景下原生 click 事件不生效的问题。
8292
- `Fix(style)` 修复微信 Webview 中的 CSS transition 失效的问题,通过使用 `bottom` 而非 `transform`
8393
- `Fix(Core)` 修复在 `onReady` 回调中调用 vConsole 方法导致报错的问题。 (issue #516)

dev/common.html

+5
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@
9393
vConsole.setOption('log.maxLogNumber', 20);
9494
vConsole.setOption({ network: { maxNetworkNumber: 30 }});
9595
vConsole.setOption({ network: { b: 123 }}); // overwrite previous line
96+
vConsole.setOption({ '__proto__': { a: 1 }, 'prototype': { b: 2 }, 'constructor': 3 });
97+
vConsole.setOption('__proto__.noOrig', 1);
98+
vConsole.setOption('prototype.noOrig', 2);
99+
vConsole.setOption('constructor', () => { console.log('hack') });
100+
vConsole.setOption('log.__proto__.noOrig', 1);
96101
console.log(vConsole.option);
97102
}
98103

dev/log.html

+9-2
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@
141141
}
142142

143143
function styling() {
144-
console.log('%c blue %c red', 'color:blue', 'color:red'); // blue red
145-
console.log('%c FOO', 'font-weight:bold', 'bar'); // FOO bar
144+
console.log('%c blue %c red', 'color:blue', 'color:red', 'Foo'); // blue red Foo
145+
console.log('%c FOO', 'font-weight:bold; font-size:18px; background-color:#00FF00; padding:3px;', 'bar'); // FOO bar
146146
console.log('%c Foo %c bar', 'color:red'); // Foo %c bar
147147
}
148148

@@ -180,6 +180,13 @@
180180
console.log('Back to level 2');
181181
console.groupEnd();
182182
console.log('Back to the outer level');
183+
184+
// console.group();
185+
// console.log('Level 2');
186+
// console.group(aa);
187+
// console.log('Level 3');
188+
// console.clear();
189+
// console.log('Now console.clear() is called.');
183190
}
184191

185192
function formattingLog() {

dev/plugin.html

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<link href="./lib/demo.css" rel="stylesheet"/>
1111

1212
<script src="../dist/vconsole.min.js"></script>
13+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
1314
</head>
1415
<body ontouchstart>
1516
<div class="page">
@@ -38,9 +39,9 @@
3839
.on('init', function() { console.log(this.id, 'init'); })
3940
.on('renderTab', function(cb) {
4041
console.log(this.id, 'renderTab');
41-
cb('<div>I am ' + this.id+'</div>');
42+
cb('<div id="tab1">I am ' + this.id+'</div>');
4243
})
43-
.on('ready', function() { console.log(this.id, 'ready'); })
44+
.on('ready', function() { console.log(this.id, 'ready', document.querySelector('#tab1')); })
4445
.on('show', function() { console.log(this.id, 'show'); })
4546
.on('hide', function() { console.log(this.id, 'hide'); })
4647
.on('showConsole', function() { console.log(this.id, 'showConsole'); })
@@ -94,7 +95,7 @@
9495

9596
function newTabUseJQuery() {
9697
console.info('newTabUseJQuery() Start');
97-
var tab = new window.vConsole.VConsolePlugin('tab4', 'Tab4');
98+
var tab = new window.VConsole.VConsolePlugin('tab4', 'Tab4');
9899
var $html = $('<div><a href="javascript:;">Alert</a></div>');
99100
$html.find('a').click(function() {
100101
alert('OK');
@@ -108,7 +109,7 @@
108109

109110
function newTabUseDOM() {
110111
console.info('newTabUseDOM() Start');
111-
var tab = new window.vConsole.VConsolePlugin('tab5', 'Tab5');
112+
var tab = new window.VConsole.VConsolePlugin('tab5', 'Tab5');
112113
var $elm = document.createElement('DIV');
113114
$elm.innerHTML = '<p>It works</p>';
114115
tab.on('renderTab', function(cb) {
@@ -136,4 +137,4 @@
136137
console.info('removePlugin() End');
137138
}
138139

139-
</script>
140+
</script>

doc/public_properties_methods.md

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ target | String, HTMLElement | true | `document.documentElement`
5757
log.maxLogNumber | Number | true | 1000 | Overflow logs will be removed from log panels.
5858
log.showTimestamps | Boolean | true | false | Display timestamps of logs.
5959
network.maxNetworkNumber | Number | true | 1000 | Overflow requests will be removed from Netowrk panel.
60+
network.ignoreUrlRegExp | RegExp | true | | Skip the requests which url match the RegExp.
6061
storage.defaultStorages | Array | true | ['cookies', 'localStorage', 'sessionStorage'] | Listed storage(s) will be available in Storage panel.
6162

6263
Example:

doc/public_properties_methods_CN.md

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ target | String, HTMLElement | true | `document.documentElement`
5656
log.maxLogNumber | Number | true | 1000 | 超出数量上限的日志会被自动清除。
5757
log.showTimestamps | Boolean | true | false | 显示日志的输出时间
5858
log.maxNetworkNumber | Number | true | 1000 | 超出数量上限的请求记录会被自动清除。
59+
network.ignoreUrlRegExp | RegExp | true | | 不展示 URL 匹配正则表达式的请求。
5960
storage.defaultStorages | Array | true | ['cookies', 'localStorage', 'sessionStorage'] | 在 Storage 面板中要加载的 storage 类型。
6061

6162
例子:

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vconsole",
3-
"version": "3.15.0",
3+
"version": "3.15.1",
44
"description": "A lightweight, extendable front-end developer tool for mobile web page.",
55
"homepage": "https://github.com/Tencent/vConsole",
66
"files": [
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,41 @@
11
<script lang="ts">
22
import { onMount, onDestroy } from 'svelte';
3+
import { useResizeObserver, hasResizeObserver } from './resizeObserver';
34
4-
export let show: boolean;
5+
export let show: boolean = !hasResizeObserver();
56
export let top: boolean;
6-
77
export let onResize: (height: number) => void = () => {};
88
99
let item: HTMLDivElement | undefined;
10-
1110
let observer: ResizeObserver | null = null;
11+
let isObservable = hasResizeObserver();
1212
1313
onMount(() => {
1414
if (show) {
1515
onResize(item.getBoundingClientRect().height);
1616
}
17-
observer = new ResizeObserver((entries) => {
18-
const entry = entries[0];
19-
if (show) onResize(entry.contentRect.height)
20-
});
21-
observer.observe(item);
17+
if (isObservable) {
18+
const ResizeObserverPolyfill = useResizeObserver();
19+
observer = new ResizeObserverPolyfill((entries) => {
20+
const entry = entries[0];
21+
if (show) onResize(entry.contentRect.height)
22+
});
23+
observer.observe(item);
24+
}
2225
});
2326
2427
onDestroy(() => {
25-
observer.disconnect();
28+
if (isObservable) {
29+
observer.disconnect();
30+
}
2631
});
2732
</script>
2833

2934
<div
3035
bind:this={item}
3136
class="vc-scroller-item"
32-
style:display={show ? "block" : "none"}
33-
style:top="{top}px"
37+
style:display={show ? 'block' : 'none'}
38+
style:top="{isObservable ? top + 'px' : 'auto'}"
3439
>
3540
<slot />
3641
</div>

src/component/recycleScroller/recycleScroller.less

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
left: 0;
2121
right: 0;
2222
}
23+
.vc-scroller-viewport.static .vc-scroller-item {
24+
display: block;
25+
position: static;
26+
}
2327

2428
.vc-scroller-footer {
2529

0 commit comments

Comments
 (0)