requarks / wiki-v1

Legacy version (1.x) of Wiki.js
https://wiki.js.org
GNU Affero General Public License v3.0
100 stars 75 forks source link

Internet Explorer compatibility #31

Open cisspking opened 6 years ago

cisspking commented 6 years ago

Actual behavior

Wiki.js is not displaying content/navigation correctly in Internet Explorer 11.0.10240.17609. 2017-10-06_9-56-24 2017-10-06_9-58-50

Expected behavior

Wiki.js should look and feel the same in Internet Explorer.

Steps to reproduce the behavior

None

braingame26 commented 6 years ago

Is compatibility with IE 11 going to be fixed anytime soon? In addition to the navigation not being displayed correctly in IE 11, I've found the search bar doesn't appear, markdown editor doesn't display correctly, and the color themes page don't display correctly.

NGPixel commented 6 years ago

IE 11 will have better support in 2.0. Fixing issues in current version is simply not a priority, because of the very low browser share.

I suggest upgrading to a modern browser like Chrome or Edge.

braingame26 commented 6 years ago

Hello, I downloaded and debugged the code and was able to fix the issue. The problem was in editor-video.vue, the regexs here:

const videoRules = {
    'youtube': new RegExp(/(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|&v(?:i)?=))([^#&?]*).*/, 'i'),
    'vimeo': new RegExp(/vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^/]*)\/videos\/|album\/(?:\d+)\/video\/|)(\d+)(?:$|\/|\?)/, 'i'),
    'dailymotion': new RegExp(/(?:dailymotion\.com(?:\/embed)?(?:\/video|\/hub)|dai\.ly)\/([0-9a-z]+)(?:[-_0-9a-zA-Z]+(?:#video=)?([a-z0-9]+)?)?/, 'i')
  }

The RegExp constructor in IE expects a string as the first parameter, not a literal as it is above. See this stack overflow post.

Following the answer's guidance, I updated the regex code to this:

const videoRules = {
    'youtube': /(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|&v(?:i)?=))([^#&?]*).*/i,
    'vimeo': /vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^/]*)\/videos\/|album\/(?:\d+)\/video\/|)(\d+)(?:$|\/|\?)/i,
    'dailymotion': /(?:dailymotion\.com(?:\/embed)?(?:\/video|\/hub)|dai\.ly)\/([0-9a-z]+)(?:[-_0-9a-zA-Z]+(?:#video=)?([a-z0-9]+)?)?/i
  }

All components started working after that. This error was being thrown before the vue files were loaded, so all the code in the vue files were not being loaded when the error was thrown. The code in the vue files is what provides functionality for all the components I said were not working (search bar, nav, markdown edtior, color themes, etc.).