Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safari 浏览器内核无法使用增强功能【[Error] SyntaxError: Invalid regular expression: invalid group specifier name (x16)】 #86

Open
wissyhost opened this issue Jul 15, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@wissyhost
Copy link

影响范围(任何WebKit内核)

  1. IPad siyuan 客户端
  2. Safari浏览器访问 Docker 部署或者伺服

Safari 浏览器报错

image

[Error] SyntaxError: Invalid regular expression: invalid group specifier name (x16)

因为Apple限制 IOS/IPad 应用只能使用WebKit内核,IPad用户无法使用替代浏览器

@Zuoqiu-Yingyi
Copy link
Owner

有没有更加详细的错误描述信息呀, 我这里没有设备进行测试😭

@Zuoqiu-Yingyi Zuoqiu-Yingyi added bug Something isn't working labels Jul 16, 2022
@wissyhost
Copy link
Author

需要哪些信息?我找资料说是正则的错误,参考资料:https://blog.csdn.net/catchaobject/article/details/122301402
// 会报错
let regExp = /(?<=:(?!/).?/).!/g;
// 改成下面这种写法
let regExp = new RegExp("(?<=:(?!/).?/).!", 'g');

@Zuoqiu-Yingyi
Copy link
Owner

Zuoqiu-Yingyi commented Jul 22, 2022

需要哪些信息?我找资料说是正则的错误,参考资料:https://blog.csdn.net/catchaobject/article/details/122301402 // 会报错 let regExp = /(?<=:(?!/).?/).!/g; // 改成下面这种写法 let regExp = new RegExp("(?<=:(?!/).?/).!", 'g');

试试在 /data/widgets/custom.js 文件中设置如下字段

export const config = {
    theme: {
        regs: {
            url: new RegExp(`^siyuan:\\/\\/blocks\\/(\\d{14}\\-[0-9a-z]{7})\\/*(?:(?:\\?)(\\w+=\\w+)(?:(?:\\&)(\\w+=\\w+))*)?$`), // 思源 URL Scheme 正则表达式
            time: new RegExp(`^(\\d+)(:[0-5]?[0-9]){0,2}(\\.\\d*)?$`), // 时间戳正则表达式
            id: new RegExp(`^\\d{14}\\-[0-9a-z]{7}$`), // 块 ID 正则表达式
            fontsize: new RegExp(`(?<=\\.b3-typography|protyle-wysiwyg|protyle-title\\s*\\{\\s*font-size\\s*:\\s*)(\\d+)(?=px(?:\\s+\\!important)?(?:\\s*;|\\}))`),
            winpath: new RegExp(`^\\/\\w\\:\\/.*$`), // Windows 路径正则表达式
            inboxid: new RegExp(`^\\d{13}$`), // 收集箱 ID 正则表达式
        },
    },
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants