soflyy / oxygen-bugs-and-features

Bug Reports & Feature Requests for Oxygen
https://oxygenbuilder.com/
314 stars 29 forks source link

Google fonts still show in editor even when disabled site-wide #236

Open dmccan opened 5 years ago

dmccan commented 5 years ago

In the Oxygen editor Google fonts still show in the settings font list even when disabled site-wide.

I replicated the issue on a Sandbox install: http://hilarious-wombat.w5.wpsandbox.pro

Steps to reproduce the behavior:

  1. New install with no templates (happens with templates also)
  2. Disable caching of Google fonts in settings
  3. Disable Google fonts site-wide
  4. Rebuild CSS cache
  5. Create a new template (name, save, and enter builder)
  6. Go to Settings > Global Styles > Fonts
  7. Google fonts are still showing in the list

Expected behavior I would expect to only see web safe fonts and fonts manually added in the list.

What actually happens Google fonts are still showing in the list

Desktop (please complete the following information):

KittenCodes commented 5 years ago

Replicated in 2.4.1.

maltmann-muc commented 2 years ago

+1

tilen-seliskar commented 2 years ago

+1

Confirmed also on 3.x and 4.0 Beta

Anticosti commented 2 years ago

+1

gerogr commented 2 years ago

+1

beziehungsweise commented 2 years ago

+1

dariobros commented 2 years ago
parodev commented 2 years ago

+1

shibupandit commented 2 years ago

+1

Anticosti commented 2 years ago

Temporary fix: / Hides Google Fonts / .oxygen-select-box-option.ng-binding[ng-hide="iframeScope.globalFontExist(font.family)"],.oxygen-select-box-option.ng-binding[ng-repeat="font in iframeScope.googleFontsList | filter:iframeScope.fontsFilter | limitTo: 20"],.oxygen-select-box-option.ng-binding[ng-click="iframeScope.setComponentFont(iframeScope.component.active.id, iframeScope.component.active.name, font.family, 'font-family');"] { display: none!important; visibility: hidden!important; }

/ Hides System Fonts - Arial, Times etc. / .oxygen-select-box-option.ng-binding[ng-hide="iframeScope.globalFontExist(font)"],.oxygen-select-box-option.ng-binding[ng-repeat="font in iframeScope.webSafeFonts | filter:iframeScope.fontsFilter | limitTo: 20"],.oxygen-select-box-option.ng-binding[ng-click="iframeScope.setComponentFont(iframeScope.component.active.id, iframeScope.component.active.name, font, 'font-family"] { display: none!important; visibility: hidden!important; }

/ Hides already selected Google Fonts / .oxygen-select-box-option.ng-binding[ng-repeat="(name,font) in iframeScope.globalSettings.fonts | filter:{font:iframeScope.fontsFilter}"], .oxygen-select-box-option.ng-binding[ng-click="iframeScope.setComponentFont(iframeScope.component.active.id, iframeScope.component.active.name, ['global', name], 'font-family');"] { display: none!important; visibility: hidden!important; }

ZacharyElkins commented 2 years ago

Another issue is that "Disable Google Fonts" doesn't actually remove the generated CSS

So, I have to override the font-family for "body" and heading tags with CSS.

idrosua commented 1 year ago

This is the solution for this issue that I use on Yabe Webfont plugin

Expected behavior I would expect to only see web safe fonts and fonts manually added in the list.

What actually happens Google fonts are still showing in the list Google fonts no longer showing in the list

<?php

/*
 * This file is part of the Yabe package.
 *
 * (c) Joshua <id@rosua.org>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

/**
 * Disable Oxygen's built-in Google Fonts.
 */
add_filter('pre_option_oxygen_vsb_disable_google_fonts', static fn ($pre_option, $option, $default) => 'true', 1_000_001, 3);
add_filter('pre_update_option_oxygen_vsb_disable_google_fonts', static fn ($value, $old_value, $option) => 'true', 1_000_001, 3);
add_filter('pre_option_oxygen_vsb_enable_google_fonts_cache', static fn ($pre_option, $option, $default) => 'true', 1_000_001, 3);
add_filter('pre_update_option_oxygen_vsb_enable_google_fonts_cache', static fn ($value, $old_value, $option) => 'true', 1_000_001, 3);
add_filter('pre_option_oxygen_vsb_google_fonts_cache', static fn ($pre_option, $option, $default) => [[
    'family' => 'Inherit',
]], 1_000_001, 3);
add_filter('pre_update_option_oxygen_vsb_google_fonts_cache', static fn ($value, $old_value, $option) => [[
    'family' => 'Inherit',
]], 1_000_001, 3);
add_action('init', fn () => remove_ecf_action(), 1_000_001);

function remove_ecf_action()
{
    remove_action('oxygen_enqueue_scripts', 'add_web_font');
    remove_action('ct_builder_ng_init', 'ct_init_elegant_custom_fonts');
}