跳至內容
選單
此問題已被標幟
1 回覆
2439 瀏覽次數

I found that the editor in the website module does not work if you are running Odoo on premises without a connection to the internet.

On a fresh install of Odoo 17 CE, with the Website module installed, when you click Edit​ on any website page, the editor does not open up.  After some seconds 2 error message boxes are displayed.

If you examine the requests that are being executed in the browser dev tools, you will see that it is attempting to access fonts.googleapis.com​ for all of the various fonts that are part of whatever website theme has been set up for the website.

I was not able to get past this error.

I believe I have tracked this down to the following file:

addons/website/static/src/scss/website\.wysiwyg\.scss

It\ appears\ that\ there\ is\ a\ bug\ in\ this\ code\ which\ is\ causing\ it\ to\ always\ default\ to\ attempting\ to\ read\ the\ fonts\ from\ fonts.googleapis.comwhen it should default to reading the fonts from the local website theme on disk.

I solved this for my immediate needs by commenting out the conditional logic. I will post this as a reply as a solution to this problem, in case anyone else runs into it.  

頭像
捨棄
作者 最佳答案

This solution is a hack and only solves the problem for this exact scenario of on premises with no internet connection. But it did solve the problem so I am posting it in case it is of use to others.

In the file: addons/website/static/src/scss/website\\.wysiwyg\\.scss

Change\ the\ very\ first\ part\ of\ the\ file\ to\ comment\ out\ the\ if\-else\ clauses\ and\ only\ execute\ what\ was\ the\ else​\ logic\.\ This\ forces\ it\ to\ use\ the\ fonts\ from\ the\ website\ theme\ on\ disk\ rather\ than\ going\ to\ googleapis\.com\.

Below\ is\ the\ code\ with\ lines\ commented\ out:

@each\ \$font\-name,\ \$font\-config\ in\ \$o\-theme\-font\-configs\ \{
//\$url:\ map\-get\(\$font\-config,\ 'url'\);
// \ @if\ \$url\ \{
// \  \ @import\ url\("https://fonts.googleapis.com/css?family=#{unquote($url)}&display=swap");
//    } @else {
        $name: map-get($font-config, 'name');
        $attachment: map-get($font-config, 'attachment');
        @if $attachment {
            @import url("/web/content/#{$attachment}/google-font-#{unquote($name)}");
      }
// }
}


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
3月 24
1651
1
11月 23
5413
1
6月 24
1722
4
5月 24
1579
Website Issue 已解決
1
4月 24
1949