Skip to content
Snippets Groups Projects
Commit a82b706d authored by Matthias Konitzny's avatar Matthias Konitzny :fire:
Browse files

CSS-Styles are now bundled into a single file.

This also partially fixes a bug which caused the admin-view of the graph to not render correctly.
parent 3dfb9e1e
No related branches found
No related tags found
No related merge requests found
Pipeline #49622 passed
import "./kg-style.css";
import "./editor/css/editor.css";
import "./display/graph";
import "./editor/js/editor";
......@@ -14,6 +14,7 @@ function ks_add_graph($atts = []): string
$div = '<div id="3d-graph"></div>'; // The id "3d-graph" indicates, that the javascript associated with this should automatically be executed
$script_path = 'build' . DIRECTORY_SEPARATOR . $GLOBALS['build'] . DIRECTORY_SEPARATOR . 'graph.js';
ks_load_styles();
wp_enqueue_script("ks-display-js", plugins_url($script_path, __FILE__), array('jquery'), false);
ks_localize("ks-display-js", $atts);
......@@ -44,6 +45,7 @@ function ks_add_editor($atts = [])
{
ks_add_editor_dependencies();
ks_localize("ks-editor-js", $atts);
ks_load_styles();
require_once(__DIR__ . '/editor/editor.php');
}
......@@ -53,16 +55,14 @@ function ks_add_editor_dependencies()
$script_path = 'build' . DIRECTORY_SEPARATOR . $GLOBALS['build'] . DIRECTORY_SEPARATOR . 'graph.js';
wp_enqueue_script("ks-editor-js", plugins_url($script_path, __FILE__), array('jquery'), false);
$style_file_version = date("ymd-Gis", filemtime(plugin_dir_path(__FILE__) . "editor/css/editor.css"));
wp_enqueue_style("ks-editor-css", plugins_url("editor/css/editor.css", __FILE__), array(), $style_file_version);
}
function kg_load_css()
{
$plugin_dir = plugin_dir_url(__FILE__);
wp_enqueue_style('kg-style', $plugin_dir . 'kg-style.css');
function ks_load_styles() {
$styles_path = 'build' . DIRECTORY_SEPARATOR . $GLOBALS['build'] . DIRECTORY_SEPARATOR . 'graph.css';
wp_enqueue_style('ks-style', plugins_url($styles_path, __FILE__));
}
function kg_escape_space_id($id)
{
return str_replace(
......@@ -108,6 +108,6 @@ function kg_editor_admin_add_page()
require_once(__DIR__ . '/datasets/datasets.php');
add_action('wp_enqueue_scripts', 'kg_load_css');
//add_action('wp_enqueue_scripts', 'kg_load_css');
add_shortcode('knowledge-space', 'ks_add_graph');
add_shortcode('knowledge-space-editor', 'ks_add_editor');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment