Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 313... Línea 313...
313
 
313
 
314
            // Add the node and select it to replicate the behaviour of execCommand.
314
            // Add the node and select it to replicate the behaviour of execCommand.
315
            selectednode = host.insertContentAtFocusPoint(link.get('outerHTML'));
315
            selectednode = host.insertContentAtFocusPoint(link.get('outerHTML'));
316
            host.setSelection(host.getSelectionFromNode(selectednode));
316
            host.setSelection(host.getSelectionFromNode(selectednode));
-
 
317
        } else {
-
 
318
            if (Y.UA.gecko > 0) {
-
 
319
                // For Firefox / Gecko we need to wrap the selection in a span so we can surround it with an anchor.
-
 
320
                // This relates to https://bugzilla.mozilla.org/show_bug.cgi?id=1906559.
-
 
321
                var originalSelection = document.getSelection();
-
 
322
                var wrapper = document.createElement('span');
-
 
323
                wrapper.setAttribute('data-wrapper', '');
-
 
324
                wrapper.style.display = 'inline';
-
 
325
 
-
 
326
                var i;
-
 
327
                for (i = 0; i < originalSelection.rangeCount; i++) {
-
 
328
                    originalSelection.getRangeAt(i).surroundContents(wrapper);
-
 
329
                }
-
 
330
                host.setSelection(host.getSelectionFromNode(Y.one(wrapper)));
317
        } else {
331
 
-
 
332
                document.execCommand('unlink', false, null);
-
 
333
                document.execCommand('createLink', false, url);
-
 
334
 
-
 
335
                var anchorNode = wrapper.parentNode;
-
 
336
                wrapper.children.forEach(function(child) {
-
 
337
                    anchorNode.appendChild(child);
-
 
338
                });
-
 
339
                wrapper.remove();
-
 
340
 
-
 
341
            } else {
318
            document.execCommand('unlink', false, null);
342
                document.execCommand('unlink', false, null);
-
 
343
                document.execCommand('createLink', false, url);
Línea 319... Línea 344...
319
            document.execCommand('createLink', false, url);
344
            }
320
 
345
 
321
            // Now set the target.
346
            // Now set the target.