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

Fix/pisa25 702/fix merge consequences #2447

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion views/js/loader/qtiLoader.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItem.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItem.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItemRunner.es5.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/loader/taoQtiItemRunner.min.js.map

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions views/js/qtiCreator/widgets/states/Deleting.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ define([
'taoQtiItem/qtiCreator/widgets/states/factory',
'taoQtiItem/qtiCreator/widgets/helpers/deletingState',
'taoQtiItem/qtiCreator/helper/gridUnits',
'taoQtiItem/qtiCreator/widgets/helpers/comments',
'taoQtiItem/qtiCreator/editor/gridEditor/helper',
'taoQtiItem/qtiCreator/editor/gridEditor/content'
], function (_, $, stateFactory, deletingHelper, gridUnits, comments, gridHelper, contentHelper) {
], function (_, $, stateFactory, deletingHelper, gridUnits, gridHelper, contentHelper) {
const DeletingState = stateFactory.create(
'deleting',
function init() {
Expand Down Expand Up @@ -146,7 +145,7 @@ define([
cols = gridUnits.redistribute(cols);

_.forEach(cols, function (col) {
let oldClass = col.elt.context.classList.value;
let oldClass = col.elt.context.classList.value
col.elt.removeClass(oldClass.match(/col-([\d]+)/).input).addClass(`col-${col.refactoredUnits}`);
gridHelper.setUnitsFromClass(col.elt);
});
Expand Down Expand Up @@ -216,8 +215,6 @@ define([
}
});
}
//remove autogenerated comments
comments.removeAutogeneratedCommentNodes(this.$elementToRemove[0]);

this.$elementToRemove.remove(); //remove html from the dom
this.widget.destroy(); //remove what remains of the widget (almost nothing), call this after element remove
Expand Down
52 changes: 27 additions & 25 deletions views/js/qtiCreator/widgets/static/helpers/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,58 +15,60 @@
*
* Copyright (c) 2014-2017 (original work) Open Assessment Technologies SA;
*/
define(['taoQtiItem/qtiCreator/widgets/helpers/comments', 'jquery', 'lodash'], function (comments, $, _) {
define([
'jquery',
'lodash'
], function($, _) {
'use strict';

var helper = {
buildInlineContainer: function (widget) {
buildInlineContainer : function(widget){
var $wrap,
textNode,
float = '';

if (widget.element.hasClass('lft')) {
if(widget.element.hasClass('lft')){
float = ' lft';
} else if (widget.element.hasClass('rgt')) {
}else if(widget.element.hasClass('rgt')){
float = ' rgt';
}

$wrap = $('<span>', {
'data-serial': widget.element.serial,
class: 'widget-box widget-inline widget-' + widget.element.qtiClass + float,
'data-qti-class': widget.element.qtiClass,
contenteditable: 'false'
'data-serial' : widget.element.serial,
'class' : 'widget-box widget-inline widget-'+widget.element.qtiClass+float,
'data-qti-class' : widget.element.qtiClass,
'contenteditable' : 'false'
});
widget.$container = widget.$original.wrap($wrap).parent();
comments.wrapWithAutogeneratedComment(widget.$container);
},
buildBlockContainer: function (widget) {
buildBlockContainer : function(widget){

//absolutely need a div here (not span), otherwise mathjax will break
var $wrap = $('<div>', {
'data-serial': widget.element.serial,
class: 'widget-box widget-block widget-' + widget.element.qtiClass,
'data-qti-class': widget.element.qtiClass
'data-serial' : widget.element.serial,
'class' : 'widget-box widget-block widget-'+widget.element.qtiClass,
'data-qti-class' : widget.element.qtiClass
});
widget.$container = widget.$original.wrap($wrap).parent();
comments.wrapWithAutogeneratedComment(widget.$container);
},
createToolbar: function (widget, toolbarTpl) {
createToolbar : function(widget, toolbarTpl){
var $tlb;

if (_.isFunction(toolbarTpl)) {
$tlb = $(
toolbarTpl({
serial: widget.serial,
state: 'active'
})
);
if(_.isFunction(toolbarTpl)){

$tlb = $(toolbarTpl({
serial : widget.serial,
state : 'active'
}));

widget.$container.append($tlb);

$tlb.find('[data-role="delete"]').on('click.widget-box', function (e) {
e.stopPropagation(); //to prevent direct deleting;
$tlb.find('[data-role="delete"]').on('click.widget-box', function(e){
e.stopPropagation();//to prevent direct deleting;
widget.changeState('deleting');
});
} else {

}else{
throw new Error('the toolbarTpl must be a handlebars function');
}
}
Expand Down
Loading